创建播放器实例,传递播放地址
WoanPlayerInterface *player = [[WoanPlayerInterface alloc]initWithContentString:self.videoPath parameters:parameters];
UIView *playView = [player getPlayViewWithFrame:CGRectMake(0, 0, 200, 200)];
playView.contentMode = UIViewContentModeScaleAspectFit;
playView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleBottomMargin;
[self.view addSubview:playView];
获取播放器视图并添加到你想展示视频的View上
自动播放
[player prepareToPlay];
手动播放
[player setShouldAutoPlay:NO];
[player prepareToPlay];
[player play];
播放状态
通过监听WoanPlayerNotification相应通知获得播放状态
WoanPlayerPlaybackDidFinishNotification
当播放结束时,发送本通知
WoanPlayerLoadDidPreparedNotification
当播放器初始化成功后,发送本通知,可在本通知后取到播放器的 Duration 等参数
WoanPlayerPlaybackErrorNotification
当播放器发生错误时,发送本通知
WoanPlayerSeekingDidFinishNotification
当播放器 Seek 成功完成后,发送本通知