开发者

MPMovie player how to get the amount of time played?

开发者 https://www.devze.com 2022-12-18 15:47 出处:网络
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

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 prope开发者_JAVA百科rty 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号