I just start to using angularjs and I want to display youtube thumbnail image from the youtube video url ... is there a way to display video thumbnail when people insert url in input and then click the button,
PLUNKER
I just start to using angularjs and I want to display youtube thumbnail image from the youtube video url ... is there a way to display video thumbnail when people insert url in input and then click the button,
PLUNKER
Youtube provide default thumbnail image of its video.
You can use below sample URL to create thumbnail image.
Where you need to search id from the given url & create url like above will give you thumbnail image.
Controller
There many ways to do this, you can refer from here
Working Plunkr Here
class
component
Here is a simple Plunker that pulls the Youtube ID from the inputted URL with a filter and then applies the image url to the image source using the Youtube provided image paths.
app.js
index.html
With AngularJS
In the controller
VideoCtrl
for example:And don't forget to
init
the API. Add this line at the end of yourindex.html
For beginners you may be interested by this answer: https://stackoverflow.com/a/25783421/2274530