Youtube provides a default image thumbnail of its video.
You can use the sample URL below to create a sketch.
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
If you need to find the identifier from the given URL and create the URL as above, you will get a thumbnail.
controller
app.controller('MyCtrl', ['$scope', function($scope) { $scope.inputs = []; $scope.addInput = function() { $scope.inputs.push({ field: '' }); } $scope.removeInput = function(index) { $scope.inputs.splice(index, 1); } $scope.set2 = function($ayd) { var thumb = getParameterByName(this.input.ayd, 'v'), url = 'http://img.youtube.com/vi/' + thumb + '/default.jpg'; this.thumb = url } function getParameterByName(url, name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(url); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } } ]);
There are many ways to do this, you can send from here.
Working plunkr here
source share