iOS does not show/play video in UIWebView iframe - ios

I use UIWebView with the:
var html:String = "<iframe src='http://46.101.234.111/trailers/suicide_squads_1' width='100%' height='200px' scrolling='no' frameborder='no'></iframe>"
cell.trailerView.loadHTMLString(html, baseURL: nil)
but it doesn't show/play the video on start. It just show play icon on white row and when I press on it - nothing happens.
iframe works, I checked it. What is the problem and how can I fix it?

Videos on the iPhone will not auto play from websites. Also make sure the video is in a format that can be played on an iPhone.

Related

HTML5 video play button not showing on iOS iPad

I have a HTML5 video that has a play button rendered by Safari on the iPhone but I can't figure out why it's not appearing on the iPad.
I took a look at Streamable and Gfycat and they both have a play button on their html5 videos.
I do not want to render the controls attribute of the video.
I got it to show using this script.
if((navigator.userAgent.match(/iPad/i)) && (navigator.userAgent.match(/iPad/i)!= null)){
$('video').prop("controls",true);
}

Direct full screen of html5 video when starting to play in UIWebview

We serve 3rd party videos in a iOS native app through UIWebviews.
On the iPhone when playing a video it directly switches to a fullscreen video view. On the iPad the video plays inline. This is expected according to Apple documentation.
This is because the value:
webView.allowsInlineMediaPlayback
is by default set to NO on iPhone and YES to iPad.
I would like to see the same behaviour on playback on the iPhone as on the iPad. So that is plays the video directly fullscreen. Setting webView.allowsInlineMediaPlayback to NO does not do the trick.
In your HTML5 source code add playsinline like in this example:
video controls="controls" webkit-playsinline="webkit-playsinline">
In your app, in the method you are calling to setup webview add
webView.allowsInlineMediaPlayback = YES;
Unfortunately the conclusion here is that it is not possible.

Keep jquerymobile header on fullscreen video

Im working on jquerymobile app, where I have a few videos from youtube.
To play videos I am using video.js html5 player with youtube plugin.
When video is playing I have some video description showing in the header, which works fine.
The problem Im having is when activating fullscreen mode on the player, video resize fullscreen and header disappears which is not what I want.
I would like to keep header visible even if video is on fullscreen.
I tried to use data-fullscreen attribute, adjust z-index of header but nothing works - header disappears on fullscreen.
Is there any way to keep header always visible on fullscreen?
I created simple demo here http://jsfiddle.net/machumba/ewbpy5s7/2/
<iframe
width="100%"
height="300"
src="http://jsfiddle.net/machumba/ewbpy5s7/2/embedded/"
allowfullscreen="allowfullscreen"
frameborder="0">
</iframe>

How to Restrict the Video Playing With in the UIWebView Only as in the given Frame

My requirement is I do not want to show the video playing in full screen.
For that initially, I choose the MPMoviePlayerController. By using this static videos i.e, which is in our app are playing well but the YouTube videos i.e., contains URL are not playing, instead of that it shows blank screen.
I tried in these ways:- http://pastie.org/8484597 You may think that all the ways are same.. But I tried all the ways as I googled I got these are all the ways.
Later, I moved to UIWebView. Yes, it is absolutely good.. it is playing my videos with No Doubt. Here I am extracting the youtube id and playing. But here, I do not want to play the video in full view. But when I want to play the video we have to click on the UIWebView then instantly it is showing full screen with video playing. But, I want to play with in the web view only.
I followed this link but same problem.. Display video inside the Uiwebview not in device full screen
I tried in these ways.. http://pastie.org/8484621
(I used LBYouTubeExtractor also. it plays good but it is not playing all the videos. For some videos it throws _itemFailedToPlayToEnd error).
Please guide me how to do in UIWebView?.
Wrap the video within a html file and remember to add webkit-playsinline and change the webview attribute webview.allowsInlineMediaPlayback =YES; Then load the html file with the webview. This works for me.
The html file is like
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<video
webkit-playsinline
src="prog_index.m3u8"
height="200" width="200"
type="video/m3u8"
>
</video>
</body>
</html>
Cheers!

How can I force a video played in a UIWebView to be full screen on an iPad?

I'm playing a YouTube video using a UIWebView, like so:
self.webView.mediaPlaybackRequiresUserAction = NO;
self.webView.allowsInlineMediaPlayback = NO;
[self.webView loadHTMLString:videoEmbedCode baseURL:nil];
I want to force the video to play in full screen without the user tapping the button at the bottom right. This works fine on an iPhone (tap the player to play and it automatically enters full screen), but doesn't work on an iPad (the normal inline player is shown).
I assumed that setting allowsInlineMediaPlayback to NO would do the trick, but apparently not.
Is there a way to force HTML5 videos to play in full screen on an iPad?
If you are trying to play a youtube video in fullscreen directly, then Use a webview of size fullScreen and then handle its rotation accordingly and change the player size of Rotation too. If you need more help then i can help you with the code too for how to change the player size on rotation too.

Resources