How to autoplay embed youtube video - youtube

I'm trying to set embed youtube video to auto play but nothing works unless i make it muted
<iframe id="yt_vid" width="100%" height="450px" src="https://www.youtube.com/embed/<?=yt_code?>?autoplay=1&mute=1" frameborder="0" allow="autoplay encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Is there any code working on chrome and firefox?

Related

After I add option autoplay of youtube ,I can't see the ads

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.

Playing Youtube video in kaltura Player

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

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>

disable native player for embedded youtube video in ios using phonegap

I embed a youtube video into html like this;
<body>
<div class="app">
<iframe width="420" height="315" src="http://www.youtube.com/embed/mYVckxZVI_g" frameborder="0" allowfullscreen></iframe>
</div>
</body>
But when I clicked play button of embedded video, a player of iphone is opened.
How can I disable this player. Because I want to control player using javascript.
Can you help?
.

How to open a UIWebview and play video fullscreen and force landscape?

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.

Resources