8

my video not play

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

my url is

http://leuipe.fr.feedportal.com/c/3265/f/43169/s/2f1abb6/sc/35/l/0Lvideo0Blequipe0Bfr0Cvideo0Cd3b6e1d4cccs0Bhtml/story.htm

my code is

 movieURL=[NSURL URLWithString:[_dic valueForKey:kRssLink]];
 NSLog(@"%@",movieURL);
 player = [[MPMoviePlayerController alloc] init];

[player setContentURL:movieURL];
[player.view setFrame:CGRectMake (0, 100, 320, 476)];
[self.view addSubview:player.view];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];

[player play];
Volker
  • 4,640
  • 1
  • 23
  • 31
MAC113
  • 1,444
  • 12
  • 19
  • what was the problem in my code ... please tell me .... i used first time because i am new in ios. so please dont give me an -ve mark – MAC113 Mar 20 '14 at 09:18
  • `.../story.htm` doesnt look like a video url. – cweinberger Mar 20 '14 at 09:19
  • this page has an video ... when this link run in browser its play the video – MAC113 Mar 20 '14 at 09:24
  • @MAC113 more explanation will be helpful. If a video is not playing there might be several problems. Can you tell exactly what is going on (what is happening when you try to play the vid)? did you test for nil objects passed to the player ? – giorashc Mar 20 '14 at 09:35
  • if opened in a browser an then playing a video, there is some forwarding or loading involved which will only then fetch the real video url... see for example http://stackoverflow.com/questions/20592906/mpmovieplayercontroller-error-itemfailedtoplaytoend-while-playing-youtube-video – Volker Mar 20 '14 at 09:47
  • my url is same like an youtube video link ....when i try to play video its display in log like _itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0; } – MAC113 Mar 20 '14 at 10:15
  • @property(strong,nonatomic) MPMoviePlayerController *player; – MAC113 Mar 20 '14 at 10:17

8 Answers8

5

I also had the same problem,

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

But I got it fixed , there was no file located on the given URL. So make sure there is a file at the given URL.

Deepend
  • 4,057
  • 17
  • 60
  • 101
user3804687
  • 49
  • 1
  • 3
  • Thx for the hint. I checked with NSFileManager and see that the file really didn't exist. – John Jul 08 '14 at 18:15
2

I experienced this issue when using the following to generate the URL for my MPMoviePlayerController

    NSURL *url = [NSURL URLWithString:self.videoURL];

I fixed it by using:

    NSURL *url = [NSURL fileURLWithPath:self.videoURL];
Brian
  • 301
  • 3
  • 10
1

I had same issue, viewed a lot of topics and haven't found working solution. My app stores movie files on cloud storage (Parse, Amazon S3) and plays them with MPMoviePlayerController.

Reason of such behavior is next: MPMoviePlayerController doesn't want play any file without extension. So adding .mov extension to file names fixed issue.

aleksandrk
  • 31
  • 2
1

Same problem here with "file.mp4"
None of this answers resolved my problem.
I resolved it by exporting the file in quicktime:

  1. Open mp4 on Quicktime :)
  2. Go to menu: File -> Export -> iPad,iphone, ipod,...
  3. Select the proper format to your needs.

I finished with a m4v file.

0

Try to set these properties, I solve problem with the same error message by add these two properties.

[player setScalingMode:MPMovieScalingModeAspectFit];
player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
Liddle
  • 19
  • 4
0

Please check this. I found after I resized the video to smaller size (from 2048 x 1536 to 1024 x 768). It could be played on iPad 2.

chubao
  • 5,871
  • 6
  • 39
  • 64
0

This may be problem in video format also. Please check the video format is either H.264 or AVC coding. If your video format is H.264, then there are certain limitations. Please check this link https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/

Yogesh Mv
  • 1,041
  • 1
  • 6
  • 12
-1

Had a similar problem and figured out that the video's aspect ratio causes the error. Basically, a video with a certain aspect ratio will work on some devices and won't on the rest:

Device - Video Aspect Ratio

  • iPad - 4:3
  • iPhone 4-inch - 16:9
  • iPhone 3.5-inch - 3:2

Hope this helps.

yoninja
  • 1,952
  • 2
  • 31
  • 39