Sha256: 849c935585bee07ec31808bb5336c0293d474294da1701cc442e3f5bb87b923b
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
function onClientLoad() { gapi.client.load('youtube', 'v3', onYouTubeApiLoad); } function onYouTubeApiLoad() { gapi.client.setApiKey('AIzaSyAWhX3xLCfnJ-U0HEPo7R0Zc-5J9jCJoXc'); } function search() { var query = document.getElementById('query').value; var request = gapi.client.youtube.search.list({ part: 'snippet', type: 'playlist, video', maxResults: '49', q:query }); request.execute(onSearchResponse); } var ytplayer; function onYouTubeIframeAPIReady() { ytplayer = new YT.Player('spherical-video-player', { height: '30', width: '640', videoId: 'FAtdv94yzp4', }); } function onSearchResponse(response) { $("#response").html(''); response.items.forEach(function(e){ $("#response").append('<iframe id="ytplayer" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/'+ e.id.videoId +'"><img width="'+ e.snippet.thumbnails.default.width + '"src="'+ e.snippet.thumbnails.default.url +'" height="'+ e.snippet.thumbnails.default.height +'"></iframe>'); }); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search_youtube-0.1.3 | app/assets/javascripts/search_youtube/search.js |