0

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?

IronManGill
  • 7,222
  • 2
  • 31
  • 52
Chandu
  • 695
  • 2
  • 12
  • 25

2 Answers2

2

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];
abdus.me
  • 1,819
  • 22
  • 34
  • how to get the number of loops? – Chandu Oct 07 '13 at 09:46
  • You can maintain an integer counter and increment in MPMoviePlayerPlaybackDidFinishNotification to find out current playback number since there is no direct way to find out exact number of loop – abdus.me Oct 07 '13 at 11:31
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.

Grzegorz Krukowski
  • 18,081
  • 5
  • 50
  • 71