Playing videos in UIWebView broken in iOS4?
Asked Answered
I

4

7

I have an app that's worked since version 2.0 of the SDK where I create and add a UIWebView and then load the URL of an .mov to play a movie. Ever since the early version of the 4.0 beta up until the 4.0 GM this has stopped working. When I load a movie now I get the following error: :Plug-in handled load" and the movie never displays.

Is this a known issue? Am I doing something wrong in 4.0?

Ithunn answered 8/6, 2010 at 18:11 Comment(1)
To anyone having this issue: This is an undocumented bug that breaks existing apps. There's a simple workaround below, but please also file a bug report to increase the likelihood that Apple will fix it.Sproul
I
4

I figured this out. It appears to be an issue with iOS4 not being backward compatible with a UIWebView created with 'init' rather than 'initWithFrame'. In 2.0 - 3.1.3, you could only show video in a UIWebview as full screen. I think this is why it didn't matter if you called 'init' -- the movie player would kick in and go fullscreen. However, in 3.2 and higher you can now inline video in a UIWebView so you have to call initWithFrame and give it something like [[UIScreen mainScreen] bounds] so there's a visible view. Not quite sure if this is bull or not but seems to be the case.

Ithunn answered 10/6, 2010 at 3:58 Comment(3)
To be a bit more precise, the video will only play if the frame of the UIWebView has a nonzero area. I had the same issue with a UIWebView created using [[UIWebView alloc] initWithFrame:CGRectZero]. This is especially strange, since the webview doesn't actually need to be visible. The video will play even if the webView is never added to the view hierarchy, as long as its frame is nonzero.Sproul
This is correct. Even if you call <code>[[UIWebView allow] initWithFrame:CGRectMake(0,0,1,1)]</code> the video will display just fine and when you click "Done" the UIWebView will 'appear' to have been dismissed. Otherwise, I'm not sure if there's a way to detect if the video has finished so that you can hide/remove the UIWebView. Otherwise, you see a white UIWebView with a play icon in the middle.Ithunn
I thought I was the only one with this problem. But even with this workaround it doesn't work for me. I'm already doing initWithFrame but I get an alertView "This movie could not be played" in 3.2 and prior versions it runs fine. Only 4.0 doesn'tFinback
C
1

I got a situation of "this movie could not be played" when playing a video clip. This happened when recorder was just used. And this would NOT happen when player was just used.

Then I set audio session category to kAudioSessionCategory_AmbientSound after recorder finished.

This problem was solved after I did that.

Cribwork answered 14/6, 2011 at 13:21 Comment(0)
J
1

Simply just ignore it. No harm in doing so.

if (![error.localizedDescription isEqualToString:@"Plug-in handled load"])
Jecho answered 22/12, 2013 at 18:57 Comment(0)
W
0

At least in PhoneGap's ChildBrowser, the didFailLoadWithError method handles and displays this message. Simply don't display the error, problem solved, but in this specific case there are two 'done' buttons to press before you get back to the application.

Witham answered 18/1, 2012 at 16:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.