iPhone : How to get the access to the default quicktime player that is launched? - iphone

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!

Related

How to disable autoplay for YouTube video in WKWebView?

I have simple ViewController with WKWebView configured as follows:
webView.configuration.allowsInlineMediaPlayback = true
webView.configuration.mediaTypesRequiringUserActionForPlayback = .video
But right after loading a web page with YouTube video it starts to play automatically (and switching to full screen at the same time) without any user interaction which is required. How to disable autoplay?
I also had same problem,YouTube vide was playing in full screen
webview.configuration.allowsInlineMediaPlayback = true
programmatically setting allowsInlineMediaPlayback value didn't work for me
You can avoid video switching fullscreen by enable inline playback for WKWebview.
Check the webView storyboard property Interaction for Audio Playback. Yes, I know, this is a question about video, but setting the Video Playback checkbox doesn't work, at least not on a target iOS 13 simulator!
Probably just check everything in that section - inline playback, interaction for Audio, interaction for Video. That's what I'm doing, although my test shows only Audio is necessary. I suspect this is a WKWebView bug and Apple will fix it so that Video properly works instead of Audio :-)

Play youtube full screen on landscape, but inline on portrait - on iPhone

I have a view with a UIWebView on half the size of the iPhone screen.
In this webview I embed youtube videos.
The app is only in portrait mode. Though I would like to see videos play also in landscape.
Now I want the following behaviour:
When in portrait, play inline, don't go full screen.
a. For that I use "webView.allowsInlineMediaPlayback=YES;"
b. I open the webview with this link: "www.youtube.com/embed/videoid?playsinline=1"
If the user rotates the screen to landscape, I'd like the video to go full screen.
If the user then rotates back to portrait, I'd like the video to get inline again.
The rotations shouldn't stop the video in the middle, or restart the play.
What should I do?
As the embedded videos use an undocumented MPInlineVideo(Fullscreen)ViewController, you can't use its API and switch to fullscreen.
I'd thus recommend playing around with the "allowFullScreen"-parameter for the iframe-tag.
If everything fails, you should always be able to change the frame-size of the web-view so that it covers the full screen. You'd have to use width/height 100% in the iframe then.
Disclaimer: This is an educated guess. I've not actually tried to implement it that way.

Playing youtube video fullscreen in UIWebView on iOS 6

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

Replay option not displaying youtube video in UIWebView?

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

How to take control if we are playing a video /mp4 file in iphone /ipod?

What I have to do is play a video file in mp4 format. If the device is in portrait mode then it should display the video, but when the user changes the device to landscape mode it should just show an image.
But currently when I play a video, it takes control of the whole app; I can't send a notification to any event, and control only returns to my code after playing the full length video.
How can we can access another things while we are playing the video on the device?
Thanks for the help
Balraj Verma
Try spawning a new thread and then call the code to play the video from the new thread. This should leave the rest of your code free to do what it needs, unless I am misunderstanding your question.
You can use the shouldAutorotateToInterfaceOrientation: to check what orientation the device is in, and then do the logic in there.
Eg, if the orientation is portrait, start the MPMoviePlayerController playing the movie, then when the orientation changes to landscape, dismiss the moviePlayer.