I have one view control that consists of MP Movie Player control. This control loads video from url. It loads the video perfectly. When I move to the previous control which has TableView, the audio of the video is played in background prefectly. The control which has a TableView consists of 'Now Playing' button. On pressing of 'Now Playing' the user is moved back to MP Movie Player control. But the problem persist here is that the video is loaded again where it was instead of continuous playing.
You need to get the current position of the movie from the property currentPlaybackTime while on your TableView. Then when you move to the MP Movie Player control, you need to specify the currentPlaybackTime you had used in the TableView.
Related
I am currently displaying a video embedded in a view. On tap of this video I need to present it in full screen just like how App Store does it.
Right now I am using AVPlayer to embed in the view with a AVPlayerLayer. When I detect a tap on this embedded player, I am creating a AVPlayerViewController and setting its player object with the player currently embedded, but still I can notice a delay of 3~4 seconds until the player in fullscreen starts playing. How can I make this transition smooth ?
I have a table view controller that has a video view in each cell.
Each cell has a play button, slider and a full screen button.
I have implemented logic for playing , pausing and seeking the video using AVPlayerLayer.
When I click on the full screen button I am moving to another view controller where I will play the video in full screen in portrait and landscape mode
When I move to the full screen controller I want the video to play from where it was playing in the previous view controller.
And when I move back to the previous view controller the video should play from where it played in the full screen controller.
How can I achieve this? Any help will be appreciated. Thank you
I have implemented same for an audio player which has a mini player and tapping on it will open in full screen.
I have detached audio player from UI. Created singleton class of player which will update UI. So there will be only one instance of player which will update multiple UI in sync.
You can implement same logic for your player.
I have multiple moviefiles. That i would like to make a playlist of. How can i assign the next and previous buttons to go to the next movie.
I've tried to find a solution for this for a long time, but i cant seem to find a answer for this?
And i'm not talking about dismissing the current MPMoviePlayerController and opening a new one with the new video.
You can use contentURL property of MPMoviePlayerController for playing new video.
If you set this property while a movie is playing, that movie pauses and the new movie begins loading. The new movie starts playing at the beginning.
In my app the user can play a video and leave the screen and it will continue to play in the background (just the audio). They can then return to continue to watch the video. This means that the view the video is in is destroyed and then recreated at a later point. Whenever the view is recreated and the player is set on it's AVPlayerLayer there is a noticeable lag in the video and more importantly the audio.
Does anyone know how to eliminate this lag?
The key to making this work without any lag / delay in the audio or video is to store the view with the AVPlayerLayer outside of the view. When reloading the controller, instead of creating a new view and assigning its player to the same player, simply attach the old view to the new view controller's view.
The view stays in memory as long as the video is still playing, that way a new AVPlayerLayer is not created and assigned to. It is the reassigning that causes the lag.
Is it possible to play sections of a movie without using timers to do the pausing and unpausing? For example I have a movie loaded into MPMoviePlayerController, the user taps and the first section of the movie is played then the movie is paused, on the second tap another section is played and so on. Setting the initialPlayBackTime and endPlayBackTime of MPMoviePlayerController doesn't help as endPlayBackTime gets updated only when stop is called (could it be a bug?), but stopping causes an annoying flicker.
I don't think so... You need the timer and that's it.