I have strange problem with MPMoviePlayerController. When movie starts , top bar with done button & controls remain visible for few seconds.Then disappears.
I am using
[player setControlStyle:MPMovieControlStyleFullscreen];
[player setFullscreen:YES];
player is an object of MPMoviePlayerController
I just want movie to play in full screen with top bar & controls hidden
& become visible only if user taps the screen
I am using iOS 4.0
try this
before starting the video
player.controlStyle = MPMovieControlStyleNone;
and when movie starts playing then set
player.controlStyle = MPMovieControlStyleFullscreen;
You can get play callback from MPMediaPlayback protocol.
Related
I am using MPMoviePlayerController in my app to play the video and audios. I want to give an option to user to play the audio/video slower/faster then the normal speed i.e 0.5x (slower then normal ), 1x (normal speed), 2x (double speed then normal.).
I want to know is there any way that i can speed up/down the MPMoviePlayerController streaming so that user can have options to listen/view the audio/video at slower/faster speed.
i found the solution to this problem myself.
When you use MPMoviePlayerController and make its instance then you have a property of MpMoviePlayerController as currentPlaybackRate. It is set to 1.0 by default means normal playing. If you sets its value to 1.5 or 2.0 then it will play the currently playing audio at that speed.
See the following code.
MPMoviePlayerController *moviePlayer = [MPMoviePlayerController alloc]init];
moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
moviePlayer.contentURL = #"http://someduumyUrl.com" ;
moviePlayer.controlStyle = MPMovieControlStyleDefault;
[moviePlayer prepareToPlay];
moviePlayer.currentPlaybackRate = 2.0 // will play the audio at double speed.
I want to play video in MPMoviePlayerViewController, it works fine and plays video but problem is that it does not show done button unless i switch to the full screen mode. It should automatically show player along with done button as shown in attached screen.
here is the code:
mp = [[MPMoviePlayerViewController alloc] initWithContentURL:myURL];
[[mp moviePlayer] prepareToPlay];
[[mp moviePlayer] setUseApplicationAudioSession:NO];
[[mp moviePlayer] setShouldAutoplay:YES];
[[mp moviePlayer] setControlStyle:2];
[self presentMoviePlayerViewControllerAnimated:mp];
Done button will be visible only when video is played in full screen mode. So, either you need to play the video in full screen mode using the following code:
player.moviePlayer.fullscreen = YES;
Or you need to customise the control to add your own Done button.
Done button visible you set the ControlStyle.
[player.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[player.moviePlayer setFullscreen:NO animated:YES];
I am playing live streaming content. But the seek bar moves to the centre of the player if it is not in full screen mode. I observed that this is happening when the network connectivity is slow. Does anyone have a solution for this?
I want to notify the user that the network connectivity is slow.
self.movieController = [[[MPMoviePlayerController alloc]
initWithContentURL: inURL] autorelease];
movieController.shouldAutoplay = YES;
[movieController play];
I want to create an app which has a default image as the background of a view that has many buttons on it. When a user clicks on any of the buttons, a unique video plays. The buttons are gonna be almost transparent so, I want the video to play in the background of the same view itself (replacing/playing above the image) and not open in a new Player(as it does using the media player). Has anyone tried it, or does anyone have any idea?
Thank You!
#import <MediaPlayer/MPMoviePlayerController.h>
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath: moviePath]];
moviePlayer.controlStyle = MPMovieControlStyleNone;
[RootViewController.view insertSubview: moviePlayer.view aboveSubview: myView];
[moviePlayer play];
I embedded a MPMoviePlayerController on my mail view. I can play/pause the movie and seek forward/backward. But when I touch the "fullscreen button" the movie stops and the playback state is set to MPMoviePlaybackStateStopped... Should the movie be played in full screen?
Here is my code:
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
player.shouldAutoplay = NO;
player.movieSourceType = MPMovieSourceTypeFile;
player.controlStyle = MPMovieControlStyleEmbedded;
player.allowsAirPlay = YES;
player.view.frame = CGRectMake(xPos, yPos, width, height);
[self.view addSubview:player.view];
I found my bug: when pressing the full screen toggle button in MPMoviePlayerController's view, the method "viewWillLayoutSubviews" is invoked. I could never imagine this behavior...
I hope my experience can be useful to other developers.
Remember that any containing ViewController will have its viewWillDisappear, viewDidDisappear methods invoked when the MPMoviePlayerController goes full screen. Also, viewWillAppear and viewWillDisappear get called when it comes back from full screen.
If you have any logic in there that affects video playback behavior, it'll get called unless you use some conditional logic to see if the video is still playing.