I have used MPMoviePlayerController in my application to play selected video. There is also facility to start video from different location like from 10 min, 20 min, 40 min etc.
Problem in iOS 7:
The problem is when video is played I am able to pause it but it does not resume after pausing. And also the pause button does not turn into play button. After clicking pause button none of the notification like "MPMoviePlayerPlaybackStateDidChangeNotification" get invoked. And same problem occurs when video is playing in fullscreen mode.
Problem in iOS 6:
Here only problem is that pause button does not turn into play button. Here video pause and resume works properly in fullscreenmode also.
one strange behaviour:
For one video when I play it from 40 min it just works perfectly. None of the above issues occur for it. But same video does not work when played from starting or 10,20 min durations.
I have searched a lot but I found only one post here related to this issue. But this solution is not working for me.
Does anybody know how to solve this?
Use AVPlayer as MPMoviePlayer is now deprecated.
Related
Creating custom spinner for iOS and for each rotation change need to play sound. Sound itself is 0.5 sec. According to Apple's documentation I used SystemSound to play it but now I can't control volume with hardware buttons cause audio context is Volume(media) and as I understood SystemSound works in different context, Ringer.
I tried to use AVAudioPlayer but there is a small delay when sound is attaching to the player and this glitches UI(small delay so spinner doesn't rotate smoothly).
Any ideas how this can be solved ?
I was thinking about somehow programmaticaly change this context by triggering controls that are working with systemSound, but no luck.
EDITED:
I've made sure that have only 1 instance of AVAudioPlayer and didn;t stop playing sound but paused it and only after spinner finished rotating then stop and dispose, but still same result
I am working on a kids ABC learning app which will be somewhat like this app.
Petting Zoo
The user can do these gestures... Swipe UP, DOWN, LEFT , RIGHT and TOUCH and each gesture has a small animation clip (approx duration 1 -3 secs each ) linked to it like the character jumping on Swipe UP, etc. There will also be an IDLE loopable movie which will be playing continuously when there is no input from user.
So I am trying to use videos in MP4 and M4V format for these gestures but the problem is that the videos are lagging just before playing. Means they dont play instantly upon doing a gesture but take a time of say micro second to load and play.
I am looking for output like the video above. You can see that the animations are so responsive and do not hang even for little time.
My developer once achieved such smooth output with the MP4 video clips but those clips didnt have audio embedded in them and then when he used videos with audio embedded in them, they were lagging again.
Can audio be the issue for lag here ? Or anything else you experts will like to suggest.
Please help guys. Yours inputs will be very valuable for me.
You can use - (void)replaceCurrentItemWithPlayerItem:(AVPlayerItem *)item of AVPlayer.
This methods helps you to load the new item to an existing AVPlayer.
Here is the important reference for playing multiple videos using single AVPlayer.
I want to show the play icon on status bar in iOS while app is playing audio. I use AVQueuePlayer to play audio items. All works well but problem I am facing is play icon doesn't show on status bar sometimes.
The app has to support play/pause. When user taps on pause, I pause the queue player and tapping on play button will start playing the queue again. When user taps on play again, I do seeking of the player item so that it will be in sync with what it is supposed to be played at that time. But some times after tapping on play again, the queue seeks to proper time and plays but play icon doesn't show up in the status bar.
I tried by commenting out the seek code and just did play/pause. The play icon shows/hides correctly, but I am not sure what is happening with seekTime API. If I use this to seek, sometimes the icon doesn't show time.
Is this something issue happening in seekTime: API? I am using the following code for seek
[self.player.currentItem seekToTime:seekTime];
Please help me on this issue.
Thanks
I don't use AVQueuePlayer but I had a similar problem. I'm using AVAudioPlayer only and when the application starts I play an audio which is then repeated constantly. For some reason, at different times, the play icon disappears but the audio is still playing.
My solution was to apply the response of "One Man Crew" in How to display playing indication icon on status bar?
But, in addition, every time I play again, I use the following:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
I don't know if it is correct, I am new in ios development, but currently is working to me.
Please let me know if there is a better solution.
Diego.
I am developing an iPhone application in which I play a video using MPMoviePlayerController. I use custom controls to play the video.
I have a slider that shows video time line. Using this user can seek the movie to any time-line of the movie.
When user continuously moves the slider:
Pause the video only for first time; [MPMoviePlayerController-obj pause]
MPMoviePlayerController-obj.currentPlaybackTime = slider.value
When slider action ends:
Play the video; [MPMoviePlayerController-obj play]
This plays the movie from the position where user had left the slider. But, it leads to blank frame when movie completes playing. This defect occurs randomly; i.e not for all the seek'd time.
What is the reason for getting the blank frame? How do I solve this?
I'm not sure if this will work, but try setting the initialPlaybackTime to either the slider.value or to currentPlaybackTime.
For being sure that your content is not flawed, hence possibly triggering that issue, you should try to replicate your faulty MPMoviePlayerController results using Apple's reference video content.
HTTP-Streaming: bipbop.m3u8
Progressive Download & Local
Playback: sample_mpeg4.mp4
I have personally observed many issues in connection with improper encoding. Weird things tend to happen when working with lossy compressed content. This is true for video (i-frames vs. p-frames) as well as audio (variable bitrate).
One being improper playback durations being reported. Such issue may result into an unexpected finished-state. I have seen cases where MPMoviePlayerController still shows a bunch of seconds to play even though the actual video has obviously finished. Those cases occur frequently once the user seeks around within the video.
Once you made sure that the issue occurs using the given sample files as well, you should file a bug-report.
hi folks we do have a video file in our application,every thing is going fine except one,i.e the application crashes when user exits from fullscreen mode while the movie is playing and also when we pause the movie in fullscreen mode and minimize it,the video starts from the beginning i tried searching whether there is any notification available to notify but of no use plz help me out.thx in advance.
atlast after studying a lot about mpmovieplayer class refernece i could find the answer for my question which i had posted yesterday.The reason for that was i was not able to provide all the available notifications i need, now i had mentioned each and every notification for entering into full screen,exit the fullscfreen and also playbackfinished now its working fine.The only problem is when i press the toggle screen it maximizes perfectly and plays from the current playbacktime but that not the case when i minimize the screen the video plays from the begining.