Tag: avplayer

隐藏Quicktime Logo / AVPlayerViewControllerContentView图像

从avplayer中隐藏AVPlayerViewControllerContentView图像,因为它有时出现并且卡住了用户。 请find图像: –

线程1:加载AVPlayer时EXC_BAD_ACCESS(code = EXC_I386_GPFLT)

我想加载一个AVPlayer,当我select一个collectionViewCell,这是我didSelectItem代码: func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if let item = items?[indexPath.item] { showPlayer(item: item) } } func showPlayer(item: Item) { let playerLauncher = PlayerLauncher() playerLauncher.showVideoPlayer() let playerView = PlayerView() playerView.item = item playerView.setupPlayerView() } 这是我的PlayerLauncher文件: class PlayerView: UIView { var item: Item? { didSet { if let id = item?.itemId { itemId […]

AVPlayer在线模式下停止播放AESencryption离线HLSvideo

我写了一个代码来下载HLSvideo并以离线模式播放。 此代码适用于编码的video。 现在我有一个AESencryption的video,我们正在为它定制encryption密钥。 下载AESencryption的HLSvideo后,我使用下面给出的代码来提供解密video的密钥。 – (BOOL)resourceLoader:(AVAssetResourceLoader *)resourceLoader shouldWaitForLoadingOfRequestedResource:(AVAssetResourceLoadingRequest *)loadingRequest { NSString *scheme = loadingRequest.request.URL.scheme; if ([scheme isEqualToString:@"ckey"]) { NSString *request = loadingRequest.request.URL.host; NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:request]; if (data) { [loadingRequest.dataRequest respondWithData:data]; [loadingRequest finishLoading]; } else { // Data loading fail } } return NO; } 我截获一个密钥的请求,并传递存储在UserDefaults中的密钥进行解密。 当我的设备的wifi或数据连接closures时,使用自定义密钥的AESencryptionHLSvideo播放效果良好。 如果我在启用设备的wifi或数据连接时开始播放此video,或者在播放video时启用设备的wifi或数据连接, video立即停止播放,没有任何错误,从不再播放。 我检查了playerItem的accessLog和errorLog,但没有发现任何有用的东西。 在下载HLS内容后提供自定义URL密钥我正在更新.m3u8文件的内容 URI = […]

在iPhone上从stream中获取ID3标签

我从HTTP Live Stream(使用m3u,m3u8播放列表文件)无法在iPhone上获得歌曲名称和composer php姓名。 我试过从这个网站的tempomix收音机 。 这是链接到stream – http://stream21.group-network.net:9012 我正在尝试使用下一个代码: AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url]; _player = [[AVPlayer playerWithPlayerItem:playerItem] retain]; _player.actionAtItemEnd = AVPlayerActionAtItemEndNone; [_player addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:NULL]; [_player addObserver:self forKeyPath:@"currentItem" options:NSKeyValueObservingOptionNew context:NULL]; [_player addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:NULL]; 然后在这里等待callback: – (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 当callback来了 – 我检查AVPlayerStatus并运行播放。 收音机播放良好 – 但从来没有来观察ValueForKeyPath。 我知道这个问题看起来类似于这个问题,但描述的方法不适合我。 […]

'NSInvalidArgumentException',原因:' – :无法识别的select器发送

我正在尝试使用AVPlayer播放MediaItem,稍后尝试获取当前项目的持续时间(持续时间是CMTimetypes的对象): duration = [[player currentItem] duration]; 我在iPad上没有问题,但在iPod Touch中,我收到以下错误消息。 我还没有在iPhone中尝试过。 终止由于未捕获的exception'NSInvalidArgumentException'的应用程序,原因:' – [AVPlayerItem持续时间]:无法识别的select发送到实例0x186100' 任何指向修复的指针将不胜感激。

iOS中的AVPlayerViewController播放/暂停问题

我正在开发iOS应用程序。 这个应用程序基于新闻媒体。 我正在播放突出显示的新闻的小video。 我正面临AVPlayerViewController的陌生人问题。 当我播放video一切都很好。 当我离线时,缓冲区video播放完毕播放缓冲区video后,video停止,但progress bar(Slider)连续处于播放状态,video停止播放。 要获得更多的通关请看这个GIF图像: 请访问此链接了解连击。 这是我的玩家代码。 class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.playVideo() } func playVideo(){ let videoURL = NSURL(string: "http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8") let player = AVPlayer(URL: videoURL!) let playerController = AVPlayerViewController() playerController.player = player self.addChildViewController(playerController) self.view.addSubview(playerController.view) […]

URL编码问题在Swift ios中

我从我的服务器响应获取url为: HTTPS://baseURL/The+Man+in+the+High+Castle+Official+Trailer+%E2%80%93+2+th.m3u8 我正在做的编码为: videoURL = videoURL.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())! 但avplayer无法播放这个特定的url。 看起来像编码URL中的一些问题

Swift:当设备被locking时继续播放声音

我正在使用下面的代码从互联网上的URL播放声音: var audioPlayer = AVPlayer() … let audioSession = AVAudioSession.sharedInstance() audioSession.setCategory(AVAudioSessionCategoryAmbient, error: nil) let url = trackFileName let playerItem = AVPlayerItem( URL:NSURL( string:url ) ) audioPlayer = AVPlayer(playerItem:playerItem) audioPlayer.rate = 1.0; player.play() 我试图确保它在后台继续播放,这就是我使用“AVAudioSession.sharedInstance()”的原因。 当我在模拟器中通过locking屏幕来尝试它时,它会继续播放。 但是,如果我在一个设备中播放它,一旦屏幕自动自动closures,声音就会closures,或者我自己locking。 我在代码中缺less什么?

iOS无video会话播放video

我正尝试在我的应用程序中使用MPMoviePlayerController或AVPlayer播放短片。 问题是(因为我的video没有任何声音),我不想干扰其他应用程序在后台播放的声音。 我试图玩AVAudioSession : AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryAmbient withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil]; [audioSession setActive:YES error:nil]; 但我没有运气。 只要video开始播放,背景音乐就会停止。 我什至试图设置audio会话不活动: [[AVAudioSession sharedInstance] setActive:NO withOptions: AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil]; 但在这种情况下,声音停止半秒钟,然后恢复,video播放器停止播放。 有什么办法可以实现我想要做的? 谢谢。

如何selectremoteControlledEvents中的下一首歌曲

我正在使用AVPlayer ,在那里我可以控制播放,通过双击主页button或技术术语remoteControlledEvents暂停function。 我想知道如何实现它,所以我可以去remoteControlledEvents下一个轨道。 谢谢 -(void)remoteControlReceivedWithEvent:(UIEvent *)event { switch (event.subtype) { case UIEventSubtypeRemoteControlTogglePlayPause: if (avplayer.rate == 0.0) { [avplayer play]; } else { [avplayer pause]; } break; case UIEventSubtypeRemoteControlPlay: [avplayer play]; break; case UIEventSubtypeRemoteControlPause: [avplayer pause]; break; } }