_itemFailedToPlayToEnd error when playing video in MPMoviePlayerController

不打扰是莪最后的温柔 提交于 2019-12-18 08:57:54

问题


I am trying to play video using MPMoviePlayerController, and am having following error,

 _itemFailedToPlayToEnd: {
   kind = 1;
   new = 2;
   old = 0;
  }

Below is my code,

NSURL *fileURL = [NSURL URLWithString:_videoUrl];
NSLog(@" fileURL: %@",fileURL);
_moviePlayer =  [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
_moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
UIWindow *backgroundWindow = [[UIApplication sharedApplication] keyWindow];
[_moviePlayer.view setFrame:backgroundWindow.frame];
[backgroundWindow addSubview:_moviePlayer.view];
[_moviePlayer prepareToPlay];
[_moviePlayer play];

How can I resolve this issue?


回答1:


I had same issue, viewed a lot of topics and haven't found working solution. but what I have discovered that the problem with the url header response content type whose of your Movie URL.. if you try to SetContentUrl with another url from another server I guess this will solve the problem..



来源:https://stackoverflow.com/questions/22068681/itemfailedtoplaytoend-error-when-playing-video-in-mpmovieplayercontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!