我正在播放一个电视节目,该节目已经使用AVQueuePlayer切换到我项目的不同章节.我还想提供跳过上一章/下一章的可能性,或者在AVQueuePlayer播放时动态选择不同的章节.
跳过下一个项目与advanceToNextItemAVQueuePlayer提供的没有问题,但是从队列中跳回或播放特定项目没有任何相似之处.
所以我不太确定这里最好的方法是什么:
replaceCurrentItemWithPlayerItem:at actionAtItemEnd来播放nextItem并使用'replaceCurrentItemWithPlayerItem'让用户选择某个章节要么
附加信息:我按照它们应该出现在NSArray中的顺序存储不同视频的路径用户应该通过按下代表章节的按钮跳转到某些章节.按钮有标签,也是阵列中相应视频的索引.
希望我能说清楚吗?有这种情况经验的人吗?如果有人知道在哪里买一个提供功能的好的IOS VideoPlayerFramework,我也很感激这个链接.
我正在使用Apple Airplay并AVPlayer在外部显示器上显示视频,同时使用Apple TV和AirPlay在设备上显示一些控件.
我正在使用这个类AVPlayer在外部屏幕上显示:
#import "AirPlayViewController.h"
@interface AirPlayViewController ()
@end
@implementation AirPlayViewController
- (id)initWithFrame:(CGRect)iFrame{
self.view.frame = iFrame;
self.backGroundImageView = [[UIImageView alloc]initWithFrame:iFrame];
[self.view addSubview: self.backGroundImageView];
return self;
}
- (void)viewDidLoad{
[super viewDidLoad];
}
-(void)viewWillDisappear:(BOOL)animated{
[audioVideoPlayer pause];
}
-(void)playMediaWithURL:(NSURL*)aURL{
audioVideoPlayer = [AVPlayer playerWithURL:aURL];
audioVideoPlayer.usesExternalPlaybackWhileExternalScreenIsActive=YES;
audioVideoPlayer.allowsExternalPlayback= YES;
//manually resizing and adding the layer, so that the app does not get confused with airplayfunctionality
AVPlayerLayer* playerLayer = [AVPlayerLayer playerLayerWithPlayer: audioVideoPlayer];
playerLayer.frame = self.view.bounds;
[self.view.layer addSublayer:playerLayer];
if (audioVideoPlayer) {
[audioVideoPlayer play]; …Run Code Online (Sandbox Code Playgroud)