-
Notifications
You must be signed in to change notification settings - Fork 62
Play video with different source type #27
Comments
@kevinbubu I'm fairly certain that this is a bug in AVPlayer. Playing 2 consecutive videos with the same AVPlayer, each a different type, the second one will fail to play: |
@alfiehanssen Thank you for your reply. But I can use AVPlayer and play smoothly. Is it VIMVideoPlayer's bug? This is my code:
|
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!
The text was updated successfully, but these errors were encountered: