-
Notifications
You must be signed in to change notification settings - Fork 61
Play video with different source type #27
Description
Hi,
I try to play video with different source type, but the second source can't be played.
First source type is mp4, and second source type is m3u8. It's work smoothly on iOS 9 device and simulator, but it can't work on iOS 7 & 8. How can I do?
Error Log:
didFailWithError: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x174467dc0 {NSUnderlyingError=0x17005eea0 "The operation couldn’t be completed. (OSStatus error -12783.)", NSLocalizedFailureReason=An unknown error occurred (-12783), NSLocalizedDescription=The operation could not be completed}
My code:
-
(void)setupVideoPlayer
{
self.videoPlayerView = [[VIMVideoPlayerView alloc] init];
[self.videoPlayerView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.videoPlayerView setVideoFillMode:AVLayerVideoGravityResizeAspect];
[self.videoPlayerView setDelegate:self];
[self.videoPlayerView setBackgroundColor:[UIColor redColor]];
[self.view insertSubview:self.videoPlayerView atIndex:0];NSURL *URL = [NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"]; // https://secure-c.vimeocdn.com/p/video/yosemite_hd_ii_hd.mp4"];
[self.videoPlayerView.player setDelegate:self];
[self.videoPlayerView.player enableTimeUpdates];
[self.videoPlayerView.player enableAirplay];
[self.videoPlayerView.player setMuted:NO];
[self.videoPlayerView.player setLooping:NO];
[self.videoPlayerView.player setURL:URL];
[self.videoPlayerView.player play];
} -
(void)changeSourceButtonClick
{
[self.videoPlayerView.player reset];
[self.videoPlayerView.player setURL:[NSURL URLWithString:@"http://v.jxvdy.com/sendfile/w5bgP3A8JgiQQo5l0hvoNGE2H16WbN09X-ONHPq3P3C1BISgf7C-qVs6_c8oaw3zKScO78I--b0BGFBRxlpw13sf2e54QA"]];
[self.videoPlayerView.player play];
}
Thanks!