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];
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 created an app for streaming audio (and send mail as well) but I have a problem, my app will not keep playing after I press the home button.
I use XCODE 6.4 and the mediaplayer.framework to play the stream it is in viewcontroller and I have been activating the background mode Audio & airplay.
Can someone please let me know what I am doing wrong here, I really want to learn it.
code:
NSURL *videoStreamURL = [NSURL URLWithString:#"http://streamlink.m3u"];
_player = [[MPMoviePlayerController alloc] initWithContentURL:videoStreamURL];
_player.view.frame = CGRectMake(0, 530, self.view.frame.size.width, 38);
[self.view addSubview:_player.view];
[_player 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.
I use a MPMoviePlayerController to play audio (ex: http://www.stanford.edu/group/edcorner/uploads/podcast/ballmer090506.mp3) or video (ex: http://video.ted.com/talk/podcast/2011U/None/RicElias_2011U.mp4)
myMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
myMoviePlayer.view.frame = CGRectMake(-80, 80, 480, 320);
myMoviePlayer.controlStyle = MPMovieControlStyleFullscreen;
myMoviePlayer.movieSourceType = MPMovieSourceTypeFile;
myMoviePlayer.scalingMode = MPMovieScalingModeAspectFit;
myMoviePlayer.useApplicationAudioSession = TRUE;
[myMoviePlayer prepareToPlay];
[myMoviePlayer play];
It works well, my only one problem is during the loading time (between 5s and 20s if I have a bad 3G reception), I have a black screen.
I would like to have MPMoviePlayerController diplayed with the "Loading..." label and the UIActiviyIndicator in his top bar during this time, like YouTube videos.
How can I do that?
Thanks.
Just use MPMoviePlayerViewController instead of MPMoviePlayerController. It should do what you want.
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.