Embedded youtube clicps - play next? - javascript

I have few youtube clips embedded on page. Is it possible to play second clip after first finishes?

Related

How to create a clickable timestamp link on an embedded youtube video with javascript?

I would really like to have clickable time links on my website that will jump to specific times within my embedded youtube video. I know that this is possible within youtube itself (built in function on youtube where you just put the time you want in the format (0:00) and users can click it to jump to that point).
I was wondering if it is possible to mimic this function somehow with embedded youtube videos and javascript?
You can use the Youtube iFrame API. There is a function to get the current timestamp:
player.getCurrentTime():Number
Returns the elapsed time in seconds since the video started playing.
player.getDuration():Number
Returns the duration in seconds of the currently playing video. Note
that getDuration() will return 0 until the video's metadata is loaded,
which normally happens just after the video starts playing.
Use them like so:
ytplayer = document.getElementById("youtube_player");
ytplayer.getCurrentTime();

Am I allowed to hide a YouTube video after a user action?

This question is slightly different from:
https://stackoverflow.com/questions/15034835/can-i-hide-a-embeded-youtube-video-or-is-that-against-the-terms-of-use
When a user visits our website, the YouTube player is visible and in the right size. A user can play the video and see the whole video. Nothing fancy. However we want to put the player in a tabbed interface. Meaning that the user can hide the video by going to another tab. For example:
Video | Info | Share
When the site loads the Video tab is active, but users can click "Info", then the video is hidden while the video keeps playing in the background.
Is this allowed? I would say gray area but I'm not sure. We always show the YouTube logo and link to the YouTube video on youtube.com btw. Also, if a users scrolls down on youtube.com, the user also hides the video and can still hear the audio. Is this perhaps the same area?
This is in their terms of services so i would say it is not allowed
8.separate, isolate, or modify the audio or video components of any YouTube audiovisual content made available through the YouTube API;
9.promote separately the audio or video components of any YouTube audiovisual content made available through the YouTube API;
14.use a video player smaller than the minimum video player size set forth in the YouTube API documentation and specifications.
https://developers.google.com/youtube/terms?hl=it

Add my Youtube playlist on my website

I add videos to my site via the JavaScript YouTube API. It works well except that at the end of the video playback, there are several video choices that appear on my screen. I want to choose the video or videos that appear at the end of my video.
How can I do this?

Embedded youtube video restarts on resize

I have a Youtube video embedded on my site, and when the iframe that it is embedded in gets resized, the Youtube video restarts. Is this the expected behaviour? Is there any way around it? I have been trying to get the Youtube JS API working to no success, so I would prefer to not use it.
Any ideas?
How about you get the minute/second the video is at the moment of the resize so you reload it but with an auto starts on the same minute/second?
For example if you add this at the end of a youtube url it starts at minute 1 and 8 seconds:
#t=1m08s

Insert add video before main video with YouTube API

I have a page that displays YouTube videos using the YouTube API. For each video I have a specific 30 second add video that I would like to play before the main video. Is there a way to do this through the YouTube API or plain javascript/jquery?
All you need to do is embed the ad first, then when it's done playing, hide it and show the main video.
First, detect when the ad is done playing with the Youtube API player.getPlayerState() function. This returns a zero when the video is ended.
Then, hide the embed with Javascript and show the main video.

Categories

Resources