Can't get buffering status of live video with mpmovieplayercontroller ios

I am working on playing streaming video using MPmovieplayercontroller. I can also display the video playback time. I can play the video, but when it gets the buffer and restores its game state, in the meantime, it is not able to get the buffering state and so the timer does not update properly but jumps with some time. Is there a way to get it right? Please help me solve. thanks in advance

My code: -

   NSNotificationCenter.defaultCenter().addObserver(self, selector: "moviePlayBackStateChanged:", name: "MPMoviePlayerLoadStateDidChangeNotification",object:  moviePlayer)
    if(moviePlayer?.playableDuration > 0)
                        {
                            currentTime = moviePlayer!.currentPlaybackTime
                        }
                        else
                        {
                            currentTime = 0
                        }
    func moviePlayBackStateChanged(notification:NSNotification)
        {
            if(moviePlayer?.loadState == MPMovieLoadState.Playable)
            {
                currentTime = moviePlayer!.currentPlaybackTime
                println("currentTime\(currentTime)")
                lblTime?.text = stringFromTimeInterval(currentTime!)          
            }else if(moviePlayer?.loadState == MPMovieLoadState.Stalled)
            {
                lblTime?.text = stringFromTimeInterval(currentTime!)
            }
}

      

+3
ios swift mpmovieplayercontroller


source to share


No one has answered this question yet

Check out similar questions:

85
Playing YouTube videos using MPMoviePlayerController instead of UIWebView
12
Why is MPMoviePlayerController setCurrentPlaybackTime going at the wrong time?
4
MPMoviePlayerController reverse buffer video again
3
MPMoviePlayerController video does not play
2
How to get playbackState changed MPMoviePlayerController notification
1
MPMoviePlayerController won't play video
1
MPMoviePlayerController does not display video
1
Swift 2 iOS 9 animation disappears after changing button text
1
Streaming Monotouch Video with MPMoviePlayerController
0
Wrong MPMoviePlayerController behavior with M3U8 urls



All Articles
Loading...
X
Show
Funny
Dev
Pics