An avplayeritem cannot is associated with more than one instance of Avplayer
An Avplayeritem cannot is associated with more than one instance of Avplayer2014-03-11 14:03 295 People read Comments (0) favorite reports
If this problem occurs, you can not set the contentURL at initialization time.
movieplayercontroller_ = [[mpmovieplayerviewcontroller Alloc] Init];. Moviesourcetype = mpmoviesourcetypestreaming [movieplayercontroller_. MoviePlayer setcontenturl:url;
Original code: (Dingdone)
NSString *titlestr = [Mediadic Objectforkey:kmediavideotitlekey];
Nsurl *vodurl = [Mediadic Objectforkey:kmediavideourlkey];
Hgmovieplayerviewcontroller *mediaplayercontroller = [[Hgmovieplayerviewcontroller alloc] InitWithFrame: Self.view.bounds contenturl:vodurl initialtype:hgmovieplayercontrolstylefullscreen Withcontroller:nil];
[Mediaplayercontroller Alwayshidecomment:yes];
[Mediaplayercontroller Alwayshideshare:yes];
Mediaplayercontroller.contenttitle = Titlestr;
[Appnavigationcontroller Presentviewcontroller:mediaplayercontroller Animated:yes completion:^{
}];
Playing the MP4 file will flash back, instead
NSString *titlestr = [Mediadic Objectforkey:kmediavideotitlekey];
Nsurl *vodurl = [Mediadic Objectforkey:kmediavideourlkey];
Hgmovieplayerviewcontroller *mediaplayercontroller = [[Hgmovieplayerviewcontroller alloc] InitWithFrame: Self.view.bounds contenturl:nil initialtype:hgmovieplayercontrolstylefullscreen Withcontroller:nil];
[Mediaplayercontroller Setcontenturl:vodurl];
[Mediaplayercontroller play];
[Mediaplayercontroller Alwayshidecomment:yes];
[Mediaplayercontroller Alwayshideshare:yes];
Mediaplayercontroller.contenttitle = Titlestr;
[Appnavigationcontroller Presentviewcontroller:mediaplayercontroller Animated:yes completion:^{
}];
To solve the problem, the yellow-bottom part is the modified code.
An avplayeritem cannot is associated with more than one instance of Avplayer errors