disable native player for embedded youtube video in ios using phonegap - ios

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?
.

Related

How to autoplay embed youtube video

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?

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>

MPMoviePlayerController is playing YouTube video?

I found a method to play YouTube video on MPMoviePlayerController. For this simply need a right url. That url may be obtained after playing YouTube video in iframe. My UIWebView uses
this html:
<html>
<head>
</head>
<body style="margin:0">
<iframe class="youtube-player" type="text/html" width="280"
height="200" src="http://www.youtube.com/embed/VJRKaQ52ImE"
frameborder="0">
</iframe>
</body>
So after click on play in video rect, we can see msg in console like this:
YT_Player[1520:207] setting movie path: http://v12.lscache4.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass%2Coc%3AU0hQR1NLVl9FSkNOMF9LRVpB&fexp=913518%2C904531%2C910211&itag=18&ip=0.0.0.0&signature=93772DDEDFE678D8EA1A2E4669B5634BD6D4E81E.58DEF5203DEF07FB75F762D6C9C39536C84DE59C&sver=3&ratebypass=yes&expire=1312308000&key=yt1&ipbits=0&id=54944a690e762261
So here the question is - how get YT_Player object or how to generate "right" url?
There is no official API to get the "right" url, and likely there never will be. See the following link on the bottom.
http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/394c41dda8b4745a
Note that your method based on UIWebView does not play the movie in MPMoviePlayerController, but rather in a custom class called YTMoviePlayer. You can confirm it by playing a movie and then dumping the subview hierarchy starting at [[UIApplication sharedApplication] keyWindow].
For me this library did work perfectly!
https://github.com/hellozimi/HCYoutubeParser

Resources