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>
Related
When I write youtube iframe tag with autoplay like this,
<iframe width="560" height="315" src="https://www.youtube.com/embed/T_gCnf9-qW0?showinfo=0" frameborder="0" allowfullscreen></iframe>
I can see the ad while video playing but, when
<iframe width="560" height="315" src="https://www.youtube.com/embed/T_gCnf9-qW0?showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe>
I can't see the ads. i just added autoplay=1.
How can I see the ads with autoplay ?
I don't see any error with your code. You may check this documentation which shows how to set autoplay properly. Also be noted that in certain mobile browsers (such as Chrome and Safari), the HTML5 element only allows playback to take place if it's initiated by a user interaction (such as tapping on the player). As stated in this link, functions and parameters such as autoplay, playVideo(), loadVideoById() won't work in all mobile environments due to this restriction.
I am trying to play youtube video by its URL in KDP Kaltura Dynamic Player. Is there any way to Play youtube videos in KDP? The whole purpose is to integrate youtube with Kaltura Player.
You can, Try this.
<iframe id="pid_kaltura_player"
kentryid="1_j4ipv6ln"
kuiconfid="25505291"
kwidgetid="_1645161"
kpartnerid="1645161"
preload="none" width="100%" height="100%"
frameborder="0" allowfullscreen="1" title="YouTube video player"
src="https://www.youtube.com/embed/81XmhlLJhFg?controls=0&iv_load_policy=3&rel=0&fs=0&wmode=opaque&showinfo=0&widget_referrer=http%3A%2F%2Fplayer.kaltura.com%2Fmodules%2FExternalPlayers%2Ftests%2FkWidgetYouTubePlayerIframe.html&enablejsapi=1&origin=http%3A%2F%2Fplayer.kaltura.com&widgetid=1">
</iframe>
Look here for more, http://player.kaltura.com/modules/ExternalPlayers/tests/kWidgetYouTubePlayerIframe.html
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 ?
I'm trying to launch a webview that will play a youtube video full screen and landscape.
Most of the other posts on this are buggy and clunky, is there a simple and clean way I can implement this or do I have to use something like MPMoviePlayerController to get this effect?
Thanks!
The best way to display videos in UIWebViews are HTML5 video tags. YouTube uses iframes to embed their HTML5 videos:
<iframe
class="youtube-player" type="text/html" width="640" height="385"
src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
</iframe>
I don't have real experience in the forced orientation issue, so I skip this part.
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).