An avplayeritem cannot is associated with more than one instance of Avplayer errors

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.