I am using AVPlayer to play .m3u8 file. Using AVAssetImageGenerator to extract image out of it using following code :
AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:mp.contentURL options:nil];
AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1];
generate1.appliesPreferredTrackTransform = YES;
NSError *err = NULL;
CMTime time = CMTimeMake(1, 2);
CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err];
img = [[UIImage alloc] initWithCGImage:oneRef];
It always gives me error :
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x7fb4e30cbfa0 {NSUnderlyingError=0x7fb4e0e28530 "The operation couldn’t be completed. (OSStatus error -12782.)", NSLocalizedFailureReason=An unknown error occurred (-12782), NSLocalizedDescription=The operation could not be completed}
It works for mp4,mov and all major video extensions URL but not for m3u8. Any idea??
The “ Cannot Load M3U8″ Error can occur while trying to play a video on the internet. The error might display three different types of messages ie. “ Cross Domain Access Denied “, “ No levels to play ” and “ 404 not found “.
M3U8 is a playlist file format that contains path or URL pointing to an actual video or audio file or multiple media files. With a M3U8 player for browser or playback extension, you are able to play M3U8 files on the Internet. However, sometimes you may find that you cannot load M3U8 smoothly and there is only an error message displayed.
Open Google Chrome, click the three dots icon on the upper right side, select Settings > Privacy and Security > Cookies and other site data. On the new section, select Allow all cookies. After that, refresh the page to play M3U8. This method is also applicable to some crossdomain access denied errors.
Step 1. Load the M3U8 folder as the input. Open VideoProc Converter, select "Video", click "+ Video Folder" to add the source folder, or click "+ Video" to add all the TS video files in sequence from the folder. Note: Due to the particularity of M3U8 playlist, some files might not able to be loaded successfully.
Your problem is only to be expected. .m3u8 Files are not actual Asset files, rather, they are more akin to a playlist. They are used in HTTP Live Streaming and provide a location for "Segments" based on available bandwidth.
here is an example of a .m3u8 file (Apple's sample .m3u8 file)
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000
gear1/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=311111
gear2/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=484444
gear3/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=737777
gear4/prog_index.m3u8
Unfortunately, you can not create an AVAsset or AVURLAsset to represent the media in a HTTP Live stream. Reference:Apple's reference example of Asset Loading/playing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With