youtube-javascript-api

Disable autoplay in youtube javascript api

守給你的承諾、 提交于 2019-12-04 23:45:13
I know about using autoplay : 0 in params and in url. The problem is when I use the loadVideoByID() function. THe initial video seems to always not autostart. but the moment I load in new video that new one autostarts. I dont want that new one to autostart either $(document).ready(function() { var player; window.onYouTubePlayerAPIReady = function() { player = new YT.Player('player', { height : '390', width : '640', videoId : 'JW5meKfy3fY', playerVars : { 'autoplay' : 0, 'rel' : 0, 'showinfo' : 0, 'egm' : 0, 'showsearch' : 0, 'controls' : 0, 'modestbranding' : 1, }, events : { 'onReady' :

firefox addon sdk - how to retrieve “currentTime” from youtube player on youtube.com?

一世执手 提交于 2019-12-04 21:41:47
I am developing a firefox addon with SDK. What I want to do: If user is on a video of youtube the firefox addon knows the current position of youtube player (getCurrentTime()) I developed it with tabs var tabs = require("sdk/tabs"); and when tab is ready, I added contentscripfiles to it with: tabs.activeTab.attach({ contentScriptFile: [data.url("jquery-1.11.1.min.js"), data.url("myscript.js")] }); In the script "myscript.js" I want to access to the youtube player on the youtube site. I tried this: var playerelement=document.getElementById("movie_player"); I got the "<embed>" DOM Element from

I can't play youtube chromeless player on chrome extension

♀尐吖头ヾ 提交于 2019-12-04 19:19:37
I'm newbie at chrome extension. I'm making chrome extension that play youtube chromeless player. It worked on chrome web browser. But, it isn't working on chrome extension. I tested local .swf file. That is worked on chrome extension. I think, chrome extension can't call onYouTubePlayerReady() . So I called window.onYouTubePlayerReady() after swfobject.embedSWF() . But, it isn't worked at ytplayer.loadVideoById("xa8TBfPw3u0", 0); with error message. The error message was Uncaught TypeError: Object #<HTMLObjectElement> has no method 'loadVideoById' . Is there a problem in manifest.json ? Or in

Full Screen Option in Chromeless player using Javascript?

自古美人都是妖i 提交于 2019-12-04 18:02:47
I am using Youtube Javascript API to develop chromeless player. Can you tell me How to Add / Develop "Full Screen Control" using Javascript on player ? This is not something that currently exists in the YouTube api. Instead you can use the javascript fullscreen api to provide the functionality. Details can be found on MDN here. https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode The code sample would look something like this var player = new YT.player('#my-video'); // Once the user clicks a custom fullscreen button var el = document.getElementById('#my-player-element-container')

Youtube API returning current time

蓝咒 提交于 2019-12-04 17:25:54
I'm using the youtube iframe api and can't seem to find anything in the documentation or on google that references how to get the returned values on current media completion. I'm needing to build a script where I can past in time variables, in which when the variable matches up with the current time played an event can be triggered. I know in the embed API there is one, player.getCurrentTime():Number but doesn't seem to be one for the iframe API. I'm sure someone would of noticed this before. getCurrentTime is also available in youtube iframe source. To get current time code, I used a math

Use YoutubeAPI to play youtube video until a particular time and pause

让人想犯罪 __ 提交于 2019-12-04 09:26:22
Is there a way to use the Youtube API to play a video until a certain point in the video and then pause it? I've modified the code from the YouTube Player API Reference for iframe Embeds to pause play after a certain number of seconds. Demo The code works by waiting for the onPlayerStateChange event. When the event fires, it checks the event to see if it's a PLAYING event. If it is, it calculates the remaining time from the current time ( getCurrentTime() method) to the desired pause point (hardcoded as the stopPlayAt variable). It sets a Javascript timer to wait that difference and then pass

How to get a thumbnail or snapshot of a youtube video at a specific “second” with Youtube javascript API?

一曲冷凌霜 提交于 2019-12-04 01:26:24
I want to take a thumbnail image of a youtube video, let's say http://www.youtube.com/watch?v=ffaTjpA1scI at 30s or 120s. How can I do that with youtube API? I do think this is possible, because when I watch a Youtube video, if I move my cursor to the timeline, I can immediately see snapshots at specific time. I just want to retrieve these snapshots programmatically. I also tried http://img.youtube.com/vi/ /0.jpg, actually this can get the thumbnail of course, but it cannot get a snapshots at a specific time. Those specific type thumbnails (used for the timeline snapshots) are not exposed via

addEventListener in content script not working

≡放荡痞女 提交于 2019-12-04 01:09:45
问题 I've got a chrome extension with a popup.html and an injected content script. With the injected content script I'm trying to access youtube's javascript API functions and it all works fine except for one: addEventListener. The event listener of Youtube's javascript API listens for the state of the video to change. So if the end of the video is reached the state changes to 0. var currentVideo = document.getElementById('movie_player'); currentVideo.addEventListener("onStateChange",

how can I pause a youtube embed when a user scrolls away

心已入冬 提交于 2019-12-03 21:24:25
I have been trying to look for help with respect getting a video to pause when a user scrolls away. I have already been able to find help for html5 videos but now I also need to know how the youtube API can be used for the same. the html structure I have that embeds the YouTube is as follows <div class="ytube-container"> <iframe id="vplayer" src="//www.youtube.com/embed/qKaMgJwBItM?modestbranding=1&showinfo=0&modestbranding=0&controls=1&rel=0&autoplay=1&vq=hd720" frameborder="0"webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> I used the following for html5 - does the

Fetching YouTube video title from known video id

*爱你&永不变心* 提交于 2019-12-03 16:20:36
I want to fetch a YouTube video title when the video id is known, using JavaScript only. Is it possible? Yes, it is possible using Javascript and JSON. https://developers.google.com/youtube/2.0/developers_guide_protocol_video_entries See: https://developers.google.com/youtube/2.0/developers_guide_json So you do it like this: <script type="text/javascript" src="https://gdata.youtube.com/feeds/api/videos/videoid?v=2&alt=json-in-script&format=5&callback=getTitle"> </script> And then: function getTitle(data) { var feed = data.feed; var entries = feed.entry || []; for (var i = 0; i < entries.length