Done button event MPMoviePlayerController
It worked for me on iPad when I listen to MPMoviePlayerWillExitFullscreenNotification
.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(doneButtonClick:)
name:MPMoviePlayerWillExitFullscreenNotification
object:nil];
And selector method:
-(void)doneButtonClick:(NSNotification*)aNotification{
NSNumber *reason = [notification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
if ([reason intValue] == MPMovieFinishReasonUserExited) {
// Your done button action here
}
}
Done button action of MPMoviePlayerViewController
You can use MPMoviePlayerPlaybackDidFinishNotification .
MPMoviePlayerController Audio show Done Button
i found a solution by my self.
Using the MPMoviePlayerViewController
class, instead of MPMoviePlayerController
solved the problem:
NSString *path = @"http://yourstreamingurl.com/stream.m3u";
MPMoviePlayerViewController* mpviewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]];
mpviewController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self presentModalViewController:mpviewController animated:YES];
[[mpviewController moviePlayer] play];
MPMoviePlayer done button issue
You can do that by adding a notification handler on MPMoviePlayerDidExitFullscreenNotification
as that notification gets sent once the user taps on the DONE Button.
Somewhere in your initializer
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayerDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];
Now implement that handler:
- (void)MPMoviePlayerDidExitFullscreen:(NSNotification *)notification
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerDidExitFullscreenNotification
object:nil];
[moviePlayerController stop];
[moviePlayerController.view removeFromSuperview];
}
MPMoviePlayerController Audio show Done Button
i found a solution by my self.
Using the MPMoviePlayerViewController
class, instead of MPMoviePlayerController
solved the problem:
NSString *path = @"http://yourstreamingurl.com/stream.m3u";
MPMoviePlayerViewController* mpviewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]];
mpviewController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self presentModalViewController:mpviewController animated:YES];
[[mpviewController moviePlayer] play];
Related Topics
Swift Error: Editor Placeholder in Source File
iOS Simulator Is Not Launching
Swift String Escaping When Serializing to JSON Using Codable
Locking Orientation Does Not Work on iPad iOS 8 Swift Xcode 6.2
Navigationcontroller.Navigationitem VS Navigationitem
Document Directory Path Change When Rebuild Application
Ios7 - Device Unique Identifier
How to Find Out What View a Touch Event Ended At
Clip Image to Square in Swiftui
Perform Segue from App Delegate Swift
Getting Random "Facebookerrdomain Error 10000"
Share Datas Between Two Apps with iOS 8 App Groups (Using Nsuserdefaults)
Will Push Notification Still Work After Ownership Transfer in Itunesconnect
Dyld: Library Not Loaded for a Framework Within a Framework
Custom Scenekit Geometry in Swift on iOS Not Working But Equivalent Objective C Code Does
I Added a Localization in Xcode, Removed It and Now My Storyboard Is Gone