MPMoviePlayerController creating a custom buffer progress bar for streaming movies - iphone

I am streaming a movie to MPMoviePlayerController by simply passing MPMoviePlayerController the URL of the movie file. I am using my own custom controls and would like to create a progress bar to see how much of the video has been buffered (like in YouTube) . But there doesn't seem to be any available data
to create this. Does anyone know how to do this. Thanks.

Prior to iOS 5.x the playableDuration did the job. But since iOS 5 this property seem to always return zero. Give it a try and please let me know if it does work for you.

Related

How to get the control of MoviePlayer while we are streaming video using WebView

I am trying to show YouTube videos on my application. How can I stop/pause the playing movie player after a particular amount of time. I am using/loding the url in webview rather than MPMoviePlayer. If anyone knows the solution please share. I need to implement it in one of my app.
Thanks in advance.
As you will not get any access to the actual MPMoviePlayerController and since no notifications will be visible outside the UIWebView, you will be locked into using javascript code - that is, stay within the UIWebView scope of actions.
How and if such things are exactly implemented/able using javascript, I do not know.

Is it Possible to Have own scrubber for MPMoviePlayercontroller

I want to play videos. I am using MPMoviePlayer, but I don't want to use the controls provided by MPMoviePlayer. So I am trying to create my own custom controls. All the functionality like play, pause, fullscreen, forward, backward are done. The only problem is with the scrubber. I am having one UISlider but I don't know how exactly work with this. How to track the currently playing video time? How to play video from where I will slide the thumb of slider?
If anyone knows this kindly help me in this.
Thanks in advance.
I was having a similar problem. I figured out how to create custom movie controls and put it up on github. Let me know if that helps. Feel free to ask me any questions if you want details.
First, we should note that all of this is possible in iOS 3.2+, if you are OK not to support iOS 3.1.x.
In iOS 3.2+, MPMoviePlayerController implements the MPMediaPlayback protocol, meaning that it responds to play, stop, etc., all the controls you would expect -- sounds like you already have some of this working. Please see the reference for the MPMediaPlayback protocol.
To get the MPMoviePlayerController to stop showing its own controls, do this on initialization:
yourPlayer.controlStyle = MPMovieControlStyleNone;
Finally, to get the scrubber to work, you need to set the UISlider valueChanged: callback to something, and update the value of currentPlaybackTime property. If you want to seek 10 seconds in:
yourPlayer.currentPlaybackTime = 10;

is it possible to change URL dynamically inMPMoviePlayerController

I am using MPMoviePlayerController to stream movie from the internet. And now my first application start to look nice :) BUT :) I have 4 URLs to stream (different movies), and I wan't when I tap to the movie to stop current movie and play another from another URL. Like changing channels on TV. I know how to catch tap, but I don't know how to change URL and start to play movie from that URL (like TV), any help?
I have used this tutorial to make application.
I think setContentURL is the function you're looking for. See:
Apple Documentation on MPMoviePlayerController
use [self.moviePlayer setContentURL:newUrl] to show the next video/movie. It is given in the Apple Documentation on MPMoviePlayerController. :)

Play two videos with MPMoviePlayerView Controller

I am developing an application for IPAD and I need to play two videos one after another but can not find how. I'm using MPMoviePlayerViewController to do it and do not know how to launch a share after the first video to be played and start the second. Can someone help?
what about using MPMoviePlayerPlaybackDidFinishNotification from documentation ?
In that method:
[..] you can also change the currently playing movie by changing the value in the contentURL property. [..]
(still from documentation)
hope it helps

MPMovie player how to get the amount of time played?

I was trying to go through the iPhone's sample code for mediaplayer.
I want to be able to capture the amount of time the media player has played the video. The duration at which the media player has stopped. Is there a method or property that will tell me the duration of play of the media??
Unfortunately the current API for MPMoviePlayerController allows basically no control. You can tell it to play and stop... otherwise where's a delegate method so you can be notified when the movie finishes playing and that's it, there's no additional controls. (a real bummer)
However, while we cant discuss the new 3.2 SDK yet, I'll give you a tip and say go look at the documentation of MPMoviePlayer in 3.2 and I think you'll be happy.
http://developer.apple.com/iphone/prerelease/library/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html
moviePlayer.currentPlaybackTime
It's not possible to do KVO on it but you could do like me and create an scheduledTimer which updates every second to check what the current playbacktime is and update your graphics accordingly :)
Yes, You can use the property "duration" defined by MPMediaPlayerController. Plese try it out and check the output. U can refer the here duration property