Hello Guys I am facing a wierd behaviour in my app the case is like this :
From view controller(A) present another view controller (B) which has a UIWebView that will open an URL, but sometime the URL is Video link,
Sot he video starts playing in full screen and when finish and tap on Done (Dismiss Video player) and then dismiss the Controller (B) a weird 20px appeared at the bottom of view controller(A) and the whole app will lose the 20px in all screens.
Any one has idea for what is happening, I am certain sure that it caused by playing video through UIWebView
Update 1 :
I just figured out that this could be related to the iOS itself when playing videos whether from video file or from video url (since both will be played using the same player).
My experiment was on Facebook app when I post the same links used in my app inside Facebook app then try to play the videos from the links and the behaviour showed !
I wish if could someone help to confirm if playing videos causing problems on the UI.
Related
I am developing a music app that plays audio, regular video (such as mp4) and youtube videos. It has the proper background mode enabled, as the app plays audio and regular video correctly in the background.
The following issue appears only on the iPad, not on the iPhone.
Using the YouTube-Player-iOS-Helper on iOS 8, adding the youtube video content (YTPlayerView) to another view (as a subview) works great, even when playing. However, removing that YTPlayerView from its superview automatically pauses the playback, which isn't always the desired case (sending the app to the background causes the same effect).
Is it possible to change that behaviour?
I can rationalize manually resuming the playback when the app goes to the background, however, doing the same for the 'remove from superview scenario' causes the playback to stutter for a moment.
The issue can easily be reproduced with the sample app for 'YouTube-Player-iOS-Helper', by playing a video and then changing between tabs. On the iPhone, the player does NOT pause, but on the iPad, the player DOES pause.
If it's impossible, is there other Youtube SDKs that allow this behaviour and still adhere to the official terms and conditions?
Thanks
Figured this one.
The YTPlayerView will NOT pause, on iPad or iPhone, if you remove it from its superview and immediately add it to a view again (can be a different view). That view must be inside a view controller properly rooted in the view hierarchy (not detached).
I'm developing an iOS iPad app with an embedded YouTube video.
I'm having issues when the user tries to play the video touching the red square play image from YouTube, it seems that pressing that image won't trigger the play action. However, touching anywhere outside the red square play button works.
I've tested it with the iPad user agent with same results.
When embedding with controls:0 it seems that the action triggers perfectly, but I need the default controls.
Is there anyway to keep controls:1 and detect that touch to successfully play the video?
Try playing the video itself when it is loaded. If hitting the big red button is not a compulsion add "event.target.playVideo();" to the onReady function in the embeded HTML body. I have done so and the player in my application shows the big red button and starts the video itself immediately. I have used the following YouTube iFrame library youtube-ios-player-helper
My app uses AVQueuePlayer to show video clips back to back. In testing on my AppleTV, it seems that when I switch to the next video in the queue, there is a small time gap where the Apple TV 'takes over' the screen and the home screen of the Apple TV is displayed. Is there any way to prevent this gap from happening, even a black screen or loading indicator would be a better experience.
I was having this exact same problem and was dismayed when I saw that no one had yet to find an answer.
The solution I ended up going with involved taking advantage of the multiple display support added in iOS 5. There are some helpful links in learning how to do this here:
https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40012555-CH1-SW1
http://blog.redfin.com/devblog/2012/05/creating_a_dual-screen_airplay_experience_for_ios_and_apple_tv.html#.UjCe5mRATZY
The app I am designing will basically look for the availability of an external screen. If it finds one it will play the videos on the viewcontroller I provide for that external screen. That viewcontroller can have a black background so that any pause in between videos looks natural and no longer has the Apple TV home screen pop into view for a moment.
Here is the context :
NavigationController -> FirstViewController -> SecondViewController
FirstViewController display a MPMoviePlayerController in embedded mode, and buttons to go to SecondViewController. This MPMoviePlayerController is reading a local .m4v file.
SecondViewController display a UIWebView with web pages containing YouTube videos.
Here are the steps :
the user read the video on FirstViewController (works fine)
the user press one of the buttons to go to SecondViewController
the user press one of the youtube video, that will play in embedded mode in the webView (works fine too)
the user press the Back button in NavigationItem
The problem appear at this particular moment :
When the user come back from SecondViewController, the MPMoviePlayerController is black.
I tried using prepareToPlay on the moviePlayer in viewWillAppear and/or viewDidAppear. In both cases, I got a good result for half a sec and then the MoviePlayer view is turned to black again.
I think that when the viewDidUnload is called in the SecondViewController, something happen that put a brief access to the web embbedded MoviePlayer.
Any idea about how to solve the problem ?
Note : this only appear on a device because videos don't appear on UIWebView in simulator. I tried to reproduce it with another MPMoviePlayerController in the second view but putting a prepareToPlay in the viewDidAppear solved it...
Note 2: this problem only appear on iPad. I tried to reproduce it on iPhone but the youtube player won't play video in embedded mode on iPhone...
There should be no movie player code. Just put your video url on your web view code it shall work fine.
I have a UIWebView that loads a YouTube video.
The problem is, that if the video is playing in full screen and I reload the web view to "about:blank" to stop the video, the video player remains as the top view in the window's view hierarchy and blocks everything.
Only the black video player remains visible.
Has someone encountered this issue?
Thanks.
I have the same problem.
Using the old embed code ( http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application) causes this problem for me. Similarly, the video does not rotate into landscape mode.
I've switched over to the beta code at http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html. Seems to work.
The inability to switch to landscape during playback is still there though.