How to implement only ON and OFF option on youtube video player? - youtube

I have a youtube video in my website. Here is the code :
<iframe width="100%" height="100%" src="//www.youtube.com/embed/<?php echo $youtube_key; ?>?autoplay=0&showinfo=0&controls=0&modestbrandin=1&rel=0" frameborder="0" allowfullscreen>
I want that user can only see the video. I mean user can play it or pause it. No other control even I DON'T WANT user can right click on the video player.
Now this code invisible all option but user can right click and can copy the url :(
How can I implement this type of youtube in my website where user can only see it only from my website. any suggestion ?

Related

Youtube videos not working on mobile

I have some youtube videos on my site. They works fine on desktop(and also when i resize the desktop browser screen to mobile screen size). But when i try to view those videos on mobile, the youtube app opens and the videos are played in the app and not on the website. I want the video to be played on the site itself and not in an app. Is there any solution for this?
HTML:
<embed src="http://www.youtube.com/v/xyz&hl=en_GB&fs=1?rel=0&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="370"></embed>
You should switch to using iframe instead of embed. See Youtube iFrame Player API.
The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript. Unlike the Flash and JavaScript player APIs, which both involve embedding a Flash object on your web page, the IFrame API posts content to an <iframe> tag on your page
Here's an example on how to use iframe:
<iframe title="YouTube" class="youtube-player" type="text/html" width="640" height="390" src=YOUTUBE_VIDEO frameborder="0" allowFullScreen></iframe>

Embedding YouTube video with Autoplay AND starting video at a particular time

I was wondering if it is possible to autoplay an embedded YouTube video AND also have the video start at a certain point?
Any help is appreciated.
You can just add the & to place another command in the embed script. The ? starts the first command, the & adds another. The Start command is in seconds: 1min10sec=70secs. Then just top it off with an autoplay=1 to automatically start playing.
<iframe src="https://www.youtube.com/embed/acktYyOGG6w?start=29&autoplay=1" width="1" height="1" src="" frameborder="0" allowfullscreen></iframe>
I ran into the same issue for deploying music for my church's website. The width and height were only to make it a pixel in size so the video won't show while it plays.
You see another example when you look at the playlist links.
https://www.youtube.com/watch?v=of9C-8azVh8&index=4&list=PLBjhJqE72NDQPMNhB0peXyjDQNVxSext-

recognizing the end of video in vimeo embed player in iOS

I am using vimeo embed iframe code to play videos in my ipad app.
<iframe src='http://player.vimeo.com/video/ 27127177?title=1&byline=0&portrait=1&loop=1' width='600' height='600' frameborder='10' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>>
after the video is completed vimeo is showing a list of videos related to that user or related to that video, and if the user presses on them the control is changing to Vimeo website, is there a way to detect the end of video from web view so that i can stop loading the list of videos.

Play YouTube video on mobile site without redirecting to YouTube app

I am creating a mobile web site and would like to show a small (88px by 50px) YouTube thumbnail that, when clicked, plays the video in fullscreen and returns them to the webpage. It should work in iOS and Android.
My first approach was to use <a href="http://youtube.com/watch?v=oHg5SJYRHA0>...</a>. However, on iOS, the user is redirected to the YouTube app, and they must manually navigate back to Safari.
Next, I tried embedding a small iframe player with
<iframe id="ytplayer" type="text/html" src="http://www.youtube.com/embed/T0WepLbWyq0?autoplay=1&controls=0&modestbranding=1&showinfo=0&rel=0" frameborder="0" allowfullscreen width=88 height=50></iframe>
This correctly pops up a fullscreen video with a "Done" button on iOS that brings the user back to the Safari page. However, the resulting thumbnail is dominated by a large, red "Play" button.
Is there a way to hide the red Play button on an embedded video?
Or is there another way to embed a small YouTube thumbnail on a web page that allows users to return to the page when viewing is finished?
Currently, I'm considering a) Trying to hide the ugly red Play button with an overlay that allows clicks to pass through, or b) Trying to get a direct link to the YouTube video file, since linking directly to a video file allows the user to return to the browser when finished.
However, these hacks seem complicated and brittle. Is there a better way?
Thanks!

iPhone, Mobile Safari, YouTube ... stay on page

Is it possible to have a YouTube video played on a web page in Safari on the iPhone, and have the 'done' button and 'video finished' event send the user back to the mobile web page they came from?
Currently, it seems like i'm only able to direct them to YouTube.app to view the video ... but they then remain in YouTube.app and are presented with the videos comments and other such information, and I do not wish to display this information.
If this is possible, please provide a link to a site with documentation/examples or an example in your response.
Thanks.
Use YouTube's new IFRAME-based embed code (I believe they give it to you by default now when you click their embed button...?) and on an iPhone, it will be rendered as an HTML5 video if possible.
When users tap the play icon on it, it will launch the standard video viewer, not the YouTube app. When they exit the video, they'll be back on your webpage.
The new embed code looks like this:
<iframe
title="YouTube video player"
width="480"
height="390"
src="http://www.youtube.com/embed/VIDEO-ID"
frameborder="0"
allowfullscreen>
</iframe>
This is more or less what they do in the new YouTube webapp, except that they don't need the IFRAME (they just do the HTML5 embed on their own page).

Resources