How to reset MPMoviePlayerController timeline to zero at movie end - iphone

Streaming 10 seconds movie from server, but timeline stops at 8 seconds.
There are no errors, so I would like to reset MPMoviePlayerController timeline left side as 00:10 and right side as 00:00 to make it look like the whole movie was played. How could I do that?

Try the following - assuming that you have an instance of the MPMoviePlayerController called mp;
[mp setCurrentPlaybackTime:mp.endPlaybackTime];

Haven't found any other video with same symphtons, so let's call this a bug in video data or its conversion. Case closed.

Related

count the number of loops and stop playing the audio

I have a small 4 second video file which will be played again and again.For that I have used
[player setRepeatMode:MPMovieRepeatModeOne];
but after the 1st loop I want the audio to be stopped and only video should be played.I tried setting [player setUseApplicationAudioSession:NO];
but its not working.
Any help?
There is no direct way to mute or adjust volume of MPMoviePlayerController. All you need to do is to control your device's volume.
Get MPMoviePlayerPlaybackDidFinishNotification and write Following code in specific check
[[MPMusicPlayerController applicationMusicPlayer] setVolume:0];
I don't think there is a ready to use option to count loops.
I would recommend to extend player and make your own method to play sound X times.
For that you can play this sound without repeat mode X times in a row. To detect that sound has finished playback check for MPMusicPlayerControllerPlaybackStateDidChangeNotification and beginGeneratingPlaybackNotifications. Based on that you play it again and again and decrease a count for how much times you want to play it.

MPMoviePlayer play on when application goes Background when incoming call is coming

I am developing an audio streamer and have declared an interruption listener,
that means when an interruption occurs - like an incoming call or an sms.After complete my call again automatically play that audio live stream
Explain
my first question Is it possible.... (that means if my song is ten min . After 2 min playing, suddenly incoming call is coming at that time i am talking 4 min... So my song should be continue from 6th min(that means 4 min should be background running without noise ) )
I am MPMoviePlayer in IOS5
player = [[MPMoviePlayerController alloc] initWithContentURL:audioUrl];
[player prepareToPlay];
My guess is you can do it by:
Capture the current time when you app got interrupted.
When applicationDidBecomeActive got called. Calculate the elapsed time base on the time captured above.
Initialize the MPMoviePlayerController with initialPlaybackTime to seek to the calculated offset.

iphone, my AVPlayer player is playing video really fast

My application is using AVPlayer to play video. There is a serious problem that my app currently experience. Sometimes, it is playing the video very fast although I checked to make sure that I either set the self.player.rate = 0.3 or self.player.rate = 1 or not set the rate at all. This only happens sometimes and it happens to all the videos I have.
Can anyone give me any hint on the current problem?
I finally know the answer. I called [player setRate:0.3] and [player play] at the same time and the second call override the first call, which sets the rate to be 0 (normal). The method setRate: already set the rate for the player and play the video already

How much video content is pre buffered when using AV player with HTTP Live Streaming and can that value be changed

I am writing a video app that plays streaming videos from the web and I am using AV player to do so. My question is how do I find out how much video content is pre buffered, in MPMoviePlayerController you can see the amount of buffered content on the UISlider. I would like to show the same using AV Player and also be able to change the amount of pre buffered content.
My ideal situation is - User streaming a movie file using my app, if he pauses the play button, the movie keeps buffering just like when you watch youtube videos.
Please Help !!
Thank you.
You can see the amount of data that has been loaded and buffered ahead of the playhead by looking at the AVPlayerItem loadedTimeRanges property.
e.g.
AVPlayer *player;
NSArray *loadedTimeRanges = player.currentItem.loadedTimeRanges;
NSLog(#"LoadedTimeRanges: %#", loadedTimeRanges);
In the case of my app I can see:
LoadedTimeRanges: (
"CMTimeRange: {{338070700809/1000000000 = 338.071}, {54651145016/1000000000 = 54.651, rounded}}"
)
where the second value (54.651) appears to be the amount of buffering that exists in front of the playhead. In the case of a stall this value decreases as playback continues until reaching approximately 0.
Between 55 and 60 seconds of pre-buffered content is all I've seen – you can only examine this value and cannot force the player to buffer any more data. You could, however, use this value to visually indicate the amount of data buffered to the user.

Synchronisation between sound file and animation

i have 25 images and a sound file of 2 seconds.
I am ale to play the sound and playing the animation but the synchronization is not getting between sound and the animation ...
Can any one please help me how to synchronization the animation with sound...
There are 25 frames and the sound file duration is 2 seconds...
Can any one please help me how to synchronize the both ......
Whether the animation is manual triggered by means of swiping or it s automatic ?
If it s manual like in the case of swiping you can call the sound file to play whenever the animation is (manual like swiping)done.
Post some of your code. Then we could help you.
See my answer to Animation iOS with sound file for a step by step on how to play a sound with AVAudioPlayer and then blit a specific image to the screen at exactly the right time.