I have one small problem regarding MPMoviePlayerController, i have a link that play movie when i click on that movie button, however when i click on another button the application gets crashed, i need to find how to identify that movie is playing or getting any kind of response
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
To expand on @Saurabh's answer you can check if the video is playing by
where
MPMoviePlaybackState
is defined asIn swift the way to implement @ZKV7's answer is:
where the
MPMoviePlaybackState
enum is:See apple docs for more information about the MPMoviePlayerController.
You can check
playbackState
property of MPMoviePlayerController. Refer this link -http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html
There are two parts, usually used in combination;
Register for the
MPMoviePlayerPlaybackStateDidChangeNotification
e.g. like this:Within the notification handler, you may then check in detail for the actual state - e.g. like this:
You can certainly also use the playbackState property without handling the notification that signals changes of it. Still, in most cases that is the right place to do so.
When removing/killing your movie-playback, do not forget to remove the notification handler, e.g. like this:
to check video player is in playing state or not in SWIFT