Getting Seek events from the YouTube api? - youtube-api

I am embedding a YouTube video on my page and am able to detect when the user clicks Play and Pause on the video.
I need to also be able to detect when the user does a seek / jumps to a particular part of the video (as opposed to letting it just play to that point). How do I do this?
I am using the Youtube iframe api: https://developers.google.com/youtube/iframe_api_reference
I am able to hack around this by starting a timer and checking every second if the video played by more than a second and if so considering it as a seek. However, it seems that there should be an easier way of doing this.

Related

How to play two youtube videos with play one and pause another. Similarly when I play other video the previous video would pause

Can anyone please tell me how to play and pause youtube videos? I mean to say when I pause one video it should hide and exactly at the same position another video should come . And when I pause this then again the previous video would come.Remeber - each time I toggle, the previous video must pause.
I am using You tube API and need to embed two videos over there.
I am having trouble resolving this ... please help...

Play Youtube Url In Webview without userControl in iOS

I want to play youtube url in UIWebview or MPMoviewviewcontroller.but the restriction is user should not control the playing video.could any one help ?
If you want finer control over youtube videos, theres a library (not written by me) called XCDYoutubeKit. Search for that and look at incorporating it into your app - theres a class in there that is based on MPMoviePlayerController, that allows the playing of youtube videos from their youtube id (I use it, its good). This also means you get a normal player, so you can pause, scrub through, etc.

Cannot replay YouTube video on mobile twice when rel=0

The rel parameter in YouTube API dictates whether or not related videos are shown at the end. When rel=0 the video reverts back to the thumbnail with a play button.
However on mobile (tested on iPhone / iPad / Fire Tablet) when the video goes back to the thumbnail it cannot be played a second time. It just does nothing.
I reported the issue to Google but nothing yet after a few days.
I had to resort to destroying the video and recreating it but this makes for a kind of nasty flickering.
My experience with YouTube issues is they never seem to end up fixing anything related to iOS - so I was wondering if there was any other kind of trick to prevent this.
Test page
The trouble with refreshing a webpage at a specific interval is that you dont know exactly when the video ends so you need to develop a method which the video player sends a signal when the video ends, which would then start the script to refresh the page. Otherwise you end up restarting it in the middle of the video. so personally, I would not even mess with refreshing the page. For Audio players it works ok because audio is smaller and streams more quicker. Video dont.... they always stop to buffer.
So YouTube API uses "Events" and "Listeners", so in particular, you need to design around the Event: "onStateChange".
When onStateChange = "ended" (zero) the video has ended, so then you reload the video player with the same video and set it to its Ready State again.
In theory its very easy you basically need to setup and control the entire video player through javascript. And the API gives examples on that.
http://code.google.com/apis/youtube/js_api_reference.html
http://grizzlyweb.com/webmaster/javascripts/refresh.asp
http://code.google.com/apis/youtube/forum/
Have a look at loop and playlist parameters as well. You can set playlist parameter to video ID and same video can be replayed using this.
So, it will be something like:
http://www.youtube.com/embed/{VIDEO_ID}?wmode=opaque&loop=1&version=3&playlist={VIDEO_ID}
Hope this helps!
Appears to have been fixed by YouTube.
I can now play the video multiple times (on multiple devices) without it getting stuck. Was too busy wondering why my question was getting so little attention that I forgot to check again to see if it was fixed ;-)

Play YouTube video in Flexslider slide and pause slideshow

I am using flexslider on a site and will be putting youtube videos in certain slides. However, I need the slider to stop animating while the video is playing, and resume when the video finishes. I understand that the developer has provided a solution to this exact problem using the vimeo API. Are there examples out there of an implementation using the youtube APIs? Is it possible? I am (obviously) not a javascript expert, and find that I learn best through examples/tutorials.
There's an example at https://developers.google.com/youtube/iframe_api_reference#Getting_Started for embedding an iframe YouTube player on a page, and responding to specific events. I think you should be able to adapt that to meet your needs.
Here is my option for Youtube and Vimeo, hope is help :)
https://github.com/woothemes/FlexSlider/issues/346#issuecomment-13826530

How to control FLV Playback in flash with Action Script?

How to control FLV Playback in flash with Action Script? I want to play Video in my webpage similar to YouTube. I have done it with automatic play but I want it when you press play button, then play and pause, volume, next & back as well.
There are tons of tutorials on this subject on the web (example: gotoAndLearn)
Basically you just create a Video object to which you attach a NetStream then you perform your play, pause, stop and seek operations on the NetStream which is really straightforward.
Take a look at the AS3 documentation on the videoclass also, it helped me a lot.

Resources