avplayer

Maintaining good scroll performance when using AVPlayer

冷暖自知 提交于 2019-12-28 03:18:07
问题 I'm working on an application where there is a collection view, and cells of the collection view can contain video. Right now I'm displaying the video using AVPlayer and AVPlayerLayer . Unfortunately, the scrolling performance is terrible. It seems like AVPlayer , AVPlayerItem , and AVPlayerLayer do a lot of their work on the main thread. They are constantly taking out locks, waiting on semaphores, etc. which is blocking the main thread and causing severe frame drops. Is there any way to tell

No AVPlayer Delegate? How to track when song finished playing? Objective C iPhone development

♀尐吖头ヾ 提交于 2019-12-27 13:34:46
问题 I've looked around but I can't find a delegate protocol for the AVPlayer class . What gives? I'm using its subclass, AVQueuePlayer , to play an array of AVPlayerItems , each loaded from a URL. Is there any way I can call a method when a song finishes playing? Notably at the end of the queue? And if that's not possible, is there any way I could call a method when the song STARTS playing, after buffering? I'm trying to get a loading icon in there but it turns the icon off before the music

Play notification sound using URL

扶醉桌前 提交于 2019-12-26 16:31:12
问题 I want my application to play notification sound through URL . My custom sound file lies at a particular working URL . So, I want my app to use that link to notify user about notification. I've tried AVPlayer ,since it plays sound files through URL's Check this The AVPlayer code is working when I call it using [self playselectedsong] (plz check code provided in above link) in didFinishLaunchingWithOptions of AppDelegate and viewDidLoad function of other views. Whenever the notification

URL Encoding issue in swift ios

为君一笑 提交于 2019-12-25 09:45:50
问题 I am getting url from my server response as: https://baseURL/The+Man+in+the+High+Castle+Official+Trailer+%E2%80%93+2+th.m3u8 and i am doing encoding as : videoURL = videoURL.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())! but avplayer not able to play this particular url . seems like some issue in encoding URL 回答1: Your URL is already percent-encoded. If you encode it again, the percent parts will be encoded twice, giving an invalid URL. You

AVPlayer playerWithURL not working after app restart

给你一囗甜甜゛ 提交于 2019-12-25 08:48:19
问题 I am picking a video from the user photo library and than I save the video in the user Documents Folder to be able to play the video even if the user deletes this video from his photo Library. The URL to this file is stored in Core Data. Everything works fine until the next time I run the App. Somehow it seems like the URL is no longer valid, which is strange because I am able to delete the video file when [AVPlayer playerWithURL:videoURL] fails. Here is how I pick the video URL: - (void)

iOS: taking screenshot presenting video ipad

北慕城南 提交于 2019-12-25 06:47:25
问题 I'm trying to take screenshot playing video but the screenshot always is showing blank. This is my code: UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData *data = UIImageJPEGRepresentation(viewImage, 1.0); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath

Audio streaming in ios using AVPlayer

别说谁变了你拦得住时间么 提交于 2019-12-25 03:36:10
问题 i am trying to develop a small app which should stream audio from a particular link. I am using AVPlayer for that but i dont know why its not working. Tried google but nothing seems to be relevant there. Kindly Help.. thank you - (void)viewDidLoad { [super viewDidLoad]; NSURL *url = [NSURL URLWithString:@"http://108.166.161.206:8826/stream.mp3"]; self->playerItem = [AVPlayerItem playerItemWithURL:url]; self->player = [AVPlayer playerWithPlayerItem:playerItem]; self->player = [AVPlayer

How use app closedcaption settings instead of system closed caption settings in ios

∥☆過路亽.° 提交于 2019-12-25 03:22:28
问题 In my application i have closed caption settings and i am using AVPLayer to play video/live content without showing default controls. In my app i can able or disable closed captions like switch based on that switch status i am storing BOOL value in userdefaults. Based on userdefaults i am trying to enable or disable cc for avplayer using below api. [self.player setClosedCaptionDisplayEnabled:enable]; Now problem is Even if i off cc in app but iphone system settings cc enabled that time i am

'NSInvalidArgumentException', reason: '-[AVPlayerItem duration]: unrecognized selector sent

纵饮孤独 提交于 2019-12-25 02:26:02
问题 I am trying to play a MediaItem using AVPlayer and later trying to get the duration of the current item like this (duration is an object of type CMTime): duration = [[player currentItem] duration]; I get no issues in iPad but in iPod Touch, I get the following error. I haven't tried this in iPhone yet. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AVPlayerItem duration]: unrecognized selector sent to instance 0x186100' Any pointers to the fix will be

How to open data instead standart url in AVPlayer

做~自己de王妃 提交于 2019-12-25 02:25:40
问题 How i can open data video file instead standart url in AVPlayer? let videoURL = URL(string: "https://example") but instead URL i have only var dataTs : Data = Data() and i must put it in AVPlayerController let player = AVPlayer(url: videoURL!) playerViewController.player = player 回答1: You don't need to write the data to a temporary file. You can use a named pipe instead. It's very similar to writing to a temporary file, except that it doesn't require any storage space and it's faster. If you