I have a problem playing youtube videos in fullscreen mode within UIWebView. By default video is inlined. When I switch to fullscreen (native player button), video player is resized to fullscreen and after that is quits playing and page gets refreshed.
This works just fine is iOS5 but not iOS6.
This is more obvious on iPhone cos player goes fullscreen mode as soon as video starts playing. As a results this videos can not be played on iPhone device using iOS6.x.
I know that Apple change its policy about youtube videos. But how does this helps me? How can I assure videos are also playing in fullscreen mode?
-(void)viewWillDisappear is now (iOS6) called if you play a video in fullscreen mode
try registering for UIMoviePlayerControllerDidEnter*(/Exit)*FullscreenNotification
and modifying viewWillDisappear like UIWebView Movie Player getting dismissed iOS 6 bug
Related
I've been attempting to make this work for quite a while now:
My app has the potential to play videos of Youtube from within UIWebView. The user could want to use AirPlay for this. When AirPlay is on, the device could go to sleep and normally video stops playing moments after that happens. As advised in other posts, I set the AVAudioSession category to the Playback one and it works - AirPlay continues even when the device display goes to sleep.
However, this has a side-effect; if the user has activated the app while music playback is on in the background, setting the app's audio session category to Playback causes the playing music to stop and this is definitely annoying.
Ideally, I want to set the AVAudioSession category when playback of Video starts, not when my App is activated - but I've not seen any central or UIWebview notification / delegate method to determine this.
I've got a hackish workaround for iPhone where the UIWebview hosted video player always loads full screen modal and thus can be determined. But my app is Universal and on iPad the video starts inline; I can't figure out a way to know when Video playback is going to happen. This is exactly the point when the audio category should be switched to Playback - it will actually help users who want background music playing only until video starts up.
I don't want to fool around with adding Javascript events on to Video tags inside the UIWebView - that seems too fragile to me.
Is it possible to observe any AVFoundation notifications that trigger for the UIWebView video playback? Or anyone know of any other way to determine if video playback will start / has started?
When playing a movie through a UIWebView, and then outputting to AppleTV via Airplay, turning off iPhone screen stops playback. Why?
Anyone know how to solve this so AirPlay continues when the screen is off with my app?
Doing these two things solved it for me:
Airplay of audio using AVPlayer does not work in the background (Put the key "audio" as the key in the XML of the property list)
UIWebView: HTML5 audio pauses in iOS 6 when app enters background
Looks like it works for video too!
Currently i am trying to play one youtube video in my application UIWebView. On first time playing, the video is playing perfectly and i can able to see and listen both video & audio, but when the video played completely and i select replay option present in video screen,the video is not displaying anything(its just displaying black screen) but i can able to hear audio.
Where i am going wrong, How to fix this problem ?
Tools used : XCode: 4.3.2, iOS :5.1
I am trying to play youtube videos after loading the webview. But Only Audio is being played, not video. Although I get play button in status bar, the Media Player does not become active. The Same piece of code works in iTouch 4.1 and simulator but not on iPhone 4.1/4.0. What am I missing here???
Is the default youtube application playing video? If yes, You might want to try removing the frameworks, add them again and clean build your project.
I am loading a YouTube video link in UIWebView and when I click the play button, it launches the Quicktime player and plays the video in it. The issue here is that the default orientation of the Quicktime player is Portrait--I want it to be in Landscape mode.
Even though my base view and the webview are both in landscape mode, Quicktime player still gets launched in portrait mode.
I thought I could get the access to the default quicktime player and change its orientation to landscape.
May be this is not the case, but what about intercepting the click on the link and play the video using mpmovieplayercontroller?
That's only a suggestion and probably not a real answer to your problem.
Good luck!