media player - Play stream .m3u8 audio file in iOS -
i confused this.i have url contains .m3u8 file in , when seek stream url with:
mpmovieplayercontroller *player = [[mpmovieplayercontroller alloc] initwithcontenturl:movieurl]; [player setcontrolstyle:mpmoviecontrolmodevolumeonly]; [player setfullscreen:yes]; [player preparetoplay]; [player play];
it seems can't because nil starts playing.but when utilize :
mpmovieplayerviewcontroller* controller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:movieurl]; [self presentviewcontroller:controller animated:yes completion:nil];
the viewcontroller starts playing file. what's difference?why can't in viewcontroller? in advance
mpmovieplayercontroller
lets start playing, stopping , streaming of content, meant incorporated own view hierarchy.
since ios 3.2 mpmovieplayerviewcontroller
became available, handles presentation you.
in code above, first case, not added view hierarchy.
ex:
[self.view addsubview:player.view];
another difference mpmovieplayercontroller
property of mpmovieplayerviewcontroller
.
think of mpmovieplayercontroller
player gives controls , mpmovieplayerviewcontroller
provides you, in add-on controls, presentation.
hope helps.
ios media-player m3u8
No comments:
Post a Comment