avplayer

Mac OS AVPlayer Xcode 10.2.1 swift 5.0.1 won't work

放肆的年华 提交于 2019-12-24 20:09:36
问题 I am trying to create a simple AVBasicPlayBack for Mac OS 10.14.5 Xcode 10.2.1 swift 5.0.1. I used AVPlayer it is throwing some errors. New to Mac OS Development could not figure out what is wrong. I have checked lots of documentation online. I added NSAppTransportSecurity to info.plist file shown below. info.plist file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key

Get bandwidth of stream from m3u stream

血红的双手。 提交于 2019-12-24 16:23:01
问题 I'm using AVURAsset with a HLS url. The response is like below QualityLevels(1020000)/Manifest(video,format=m3u8-aapl) #EXT-X-I-FRAME-STREAM- INF:BANDWIDTH=1189576,RESOLUTION=668x376,CODECS="avc1.4d401f",URI="QualityLevels(1020000)/Manifest(video,format=m3u8-aapl,type=keyframes)" #EXT-X-STREAM-INF:BANDWIDTH=1810952,RESOLUTION=924x520,CODECS="avc1.4d401f,mp4a.40.2",AUDIO="audio" QualityLevels(1628000)/Manifest(video,format=m3u8-aapl) #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1810952,RESOLUTION

Swift AVPlayerItem close when finished

荒凉一梦 提交于 2019-12-24 12:30:08
问题 I'm extremely new to Swift and iOS development, so please forgive my ignorance. I'm trying to have the AVPlayer close automatically when the video is done playing. I've thought to attach the "playerDidFinishPlaying" listener to receive the notification, but once I have it, I can't find the method/event to close the Controller. I'm looking to mimic the action of clicking the "Done" button. Here is a small snippet of code. Hopefully this is enough information. If not, I can provide further info

Objective-c , AVPlayer taking too much time to Resume play audio from URL

牧云@^-^@ 提交于 2019-12-24 11:28:10
问题 I have implemented AVPlayer. It is working fine. But many times during playing audio from URL, it stops/pauses automatically and takes very long time to resume/replay. On the other hand if I manually just pause and play it works fine means it does not take too much time to re-play. I want to resume/replay it whenever it is ready. Any suggestion will be great. Thank in advance !!!!!!!! My code : - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *

Playing video from NSData in objective c

别说谁变了你拦得住时间么 提交于 2019-12-24 10:13:10
问题 I have video's NSdata stored in my cache .I want to play this on AVPlayer (or some other player if ios has) but not able to understand that in which format shoul i convert NSData so that it can be played on AVplayer.I dont want to save it locally and then give filepath's to avplayer to play video. Kindly suggest is there any other way to play video from NSData.I have already spent 3 days on it but coudn't reach to any conclusion.Kindly give your suggestion.Any help or suggestion would be

Can't play a YouTube video in tvOS. Got a “Operation requires a client data source to have been registered”

☆樱花仙子☆ 提交于 2019-12-24 08:58:14
问题 When I try to play a YouTube video in tvOS I get the following error: [MediaRemote] [MRPlaybackQueueServiceClient] playbackQueueRequest AFCF4995-D293-4B5B-82F0-E701186F639F PineBoard-21384 /A600.000000x600.000000/R[0:1] responded to asset request with error Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=15 "Operation requires a client data source to have been registered." UserInfo={NSLocalizedDescription=Operation requires a client data source to have been registered.} I'm using the

How to disconnect AVPlayer from AVPlayerItem?

白昼怎懂夜的黑 提交于 2019-12-24 06:24:07
问题 I want to reuse an AVPlayerItem but keep getting this error: An AVPlayerItem cannot be associated with more than one instance of AVPlayer Before trying to reuse it, I destroy the previous AVPlayer like this: [self.player pause]; [self.player replaceCurrentItemWithPlayerItem:nil]; self.player = nil; why is the AVPlayerItem still associated and how can I disconnect it? Here is a Gist with a full reproduction of the problem (only 50 lines btw): https://gist.github.com/sbiermanlytle

AVPlayerItem.duration returns as NaN even after player.status == .readyToPlay

霸气de小男生 提交于 2019-12-24 05:54:47
问题 I have an implementation using KVO on player.status much like the suggestion documented here. Here's the relevant bits: var player: AVPlayer? var url = URL(string: "some video url")! override func viewDidLoad() { super.viewDidLoad() initializeVideoPlayer() } func initializeVideoPlayer() { let playerItem = AVPlayerItem(url: url) self.player = AVPlayer(playerItem: playerItem) let playerLayer = AVPlayerLayer(player: player) playerLayer.frame = self.view.layer.bounds videoView.layer.addSublayer

AVPlayerItem.duration returns as NaN even after player.status == .readyToPlay

霸气de小男生 提交于 2019-12-24 05:54:05
问题 I have an implementation using KVO on player.status much like the suggestion documented here. Here's the relevant bits: var player: AVPlayer? var url = URL(string: "some video url")! override func viewDidLoad() { super.viewDidLoad() initializeVideoPlayer() } func initializeVideoPlayer() { let playerItem = AVPlayerItem(url: url) self.player = AVPlayer(playerItem: playerItem) let playerLayer = AVPlayerLayer(player: player) playerLayer.frame = self.view.layer.bounds videoView.layer.addSublayer

nsinvalidargumentexception' reason 'an avplayeritem cannot be associated with more than one instance of avplayer'

≡放荡痞女 提交于 2019-12-24 04:10:43
问题 I am using MPMoviePlayerController for play video and in this I used custom seek bar to jump video. but when I continuously do the seeking forward and rewind then application crashed and throw below error: nsinvalidargumentexception' reason 'an avplayeritem cannot be associated with more than one instance of avplayer' So please suggest. Thanks 回答1: Had same issue, try setting ContentURL after Setting the SourceType like below, moviePlayerController_ = [[MPMoviePlayerViewController alloc] init