My app has video content in documents folder /playlists/ - it's playlists folder i use m3u format. /videoContent/ - it's videos folder.
FIRST. And when i run player with code for load playlist and content from server
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://mbp.local/rat/playlists/Playlist.a60df6084e7d38b12f84afc602bb39ef.m3u"]];
m3u
#EXTM3U
#EXTINF:3000,abc
http://mbp.local/rat/videoContent/1.82aa02198c0255eddc1e538c184c176b.mov
#EXTINF:3111,cab
http://mbp.local/rat/videoContent/9.4e574f9485a9031c536425b7f79ef545.mp4
Thats not works with message in log:
2014-01-11 04:06:04.573 RAT[736:70b] Internal Log: Video playing
2014-01-11 04:06:04.606 RAT[736:70b] Internal Log: Video paused
2014-01-11 04:06:04.615 RAT[736:70b] Internal Log: Video playing
2014-01-11 04:06:04.680 RAT[736:70b] _itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
}
2014-01-11 04:06:04.683 RAT[736:70b] Internal Log: Video stopped
2014-01-11 04:06:04.688 RAT[736:70b] Internal Log: Video stopped
SECOND
When i try play playlist from documents folder.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[NSString stringWithFormat: @"%@/playlists/Playlist.a60df6084e7d38b12f84afc602bb39ef.m3u",documentsFolderPath]]];
m3u with relative paths as described in specification.
#EXTM3U
#EXTINF:3000,abc
../videoContent/1.82aa02198c0255eddc1e538c184c176b.mov
#EXTINF:3111,cab
../videoContent/9.4e574f9485a9031c536425b7f79ef545.mp4
Then i see some log message as in first try.
THIRD Play playlist from documents folder, and play list contains full path.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[NSString stringWithFormat: @"%@/playlists/Playlist.a60df6084e7d38b12f84afc602bb39ef.m3u",documentsFolderPath]]];
m3u
#EXTM3U
#EXTINF:3000,abc
/Users/royalblue/Library/Application Support/iPhone Simulator/7.0.3/Applications/96C671E3-EE7F-484E-A548-846E4D917CDD/Documents/videoContent/1.82aa02198c0255eddc1e538c184c176b.mov
#EXTINF:3111,cab
/Users/royalblue/Library/Application Support/iPhone Simulator/7.0.3/Applications/96C671E3-EE7F-484E-A548-846E4D917CDD/Documents/videoContent/9.4e574f9485a9031c536425b7f79ef545.mp4
LOG
2014-01-11 04:09:11.220 RAT[788:70b] Internal Log: Video playing
2014-01-11 04:09:11.241 RAT[788:70b] Internal Log: Video paused
2014-01-11 04:09:11.247 RAT[788:70b] Internal Log: Video playing
2014-01-11 04:09:11.254 RAT[788:70b] Internal Log: Video stopped
2014-01-11 04:09:11.308 RAT[788:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An AVPlayerItem cannot be associated with more than one instance of AVPlayer'
*** First throw call stack:
(
0 CoreFoundation 0x01ed05e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018768b6 objc_exception_throw + 44
2 AVFoundation 0x00161101 -[AVPlayerItem _attachToFigPlayer] + 0
3 AVFoundation 0x00152ebb -[AVPlayer _attachItem:andPerformOperation:withObject:] + 286
4 AVFoundation 0x00151eb3 -[AVPlayer _insertItem:afterItem:] + 55
5 AVFoundation 0x001726fe -[AVQueuePlayer insertItem:afterItem:] + 148
6 MediaPlayer 0x01b88c53 -[MPQueuePlayer insertItem:afterItem:] + 68
7 MediaPlayer 0x01b6367e __89-[MPAVQueuePlayerFeeder _updatePlayerQueueWithRemovedItems:addedItems:removeCurrentItem:]_block_invoke382 + 890
8 libdispatch.dylib 0x0216a7f8 _dispatch_call_block_and_release + 15
9 libdispatch.dylib 0x0217f4b0 _dispatch_client_callout + 14
10 libdispatch.dylib 0x0216d75e _dispatch_main_queue_callback_4CF + 340
11 CoreFoundation 0x01f35a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
12 CoreFoundation 0x01e766bb __CFRunLoopRun + 1963
13 CoreFoundation 0x01e75ac3 CFRunLoopRunSpecific + 467
14 CoreFoundation 0x01e758db CFRunLoopRunInMode + 123
15 GraphicsServices 0x027f89e2 GSEventRunModal + 192
16 GraphicsServices 0x027f8809 GSEventRun + 104
17 UIKit 0x005e4d3b UIApplicationMain + 1225
18 RAT 0x0000cfad main + 141
19 libdyld.dylib 0x0241170d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
But if i play video directly from folder or server without playlist - all fine.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[NSString stringWithFormat: @"%@/videoContent/1.82aa02198c0255eddc1e538c184c176b.mov",documentsFolderPath]]];
And if i play playlist from external video streaming server with m3u-all fine too.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear3/prog_index.m3u8"]];
Whats happend? I don't know.
Had same issue, try setting ContentURL after Setting the SourceType like below,
Source: devforums.apple.com/message/467199
Hope it helps