avplayer

How to stream audio for only a known duration using swift

老子叫甜甜 提交于 2020-01-23 02:57:28
问题 I'm using AVPlayer (I don't need to, but I wanna stream it and start playing as soon as possible) to play an m4a file (it's an iTunes audio preview). Only I only want it to play a part of that file. I'm able to set a start time but not an end time. Using a timer is not working because I'm using URL as a http address. I'm playing as it loads, without downloading the file. I also saw solutions in Objective-C to use KVO to know when music starts playing but I'm thinking this is not the best

How can I export a AVPlayer audio mp3 file using AVAssetExportSession?

痞子三分冷 提交于 2020-01-22 15:34:05
问题 I am now trying to export an mp3 file that has been player using AVPlayer (using an url) so it doesn't have to be downloaded twice. This is my sample code: I've tried every outputFileType... self.exporter = [[AVAssetExportSession alloc] initWithAsset:self.asset presetName:AVAssetExportPresetPassthrough]; } NSError *error; NSLog(@"export.supportedFileTypes : %@",self.exporter.supportedFileTypes); // "com.apple.quicktime-movie", // "com.apple.m4a-audio", // "public.mpeg-4", // "com.apple.m4v

Unable to receive remoteControlReceivedWithEvent - objective c - ios

牧云@^-^@ 提交于 2020-01-20 06:16:24
问题 I successfully enabled my app to be able to play audio and video in background after the screen is locked. However, for better user experience I want to show play and pause controls of the running media on the locked screen. After following couple of blogs online, added the following code: @interface MyControllerClass () <UIGestureRecognizerDelegate, UIApplicationDelegate> - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication]

Unable to receive remoteControlReceivedWithEvent - objective c - ios

我的未来我决定 提交于 2020-01-20 06:13:37
问题 I successfully enabled my app to be able to play audio and video in background after the screen is locked. However, for better user experience I want to show play and pause controls of the running media on the locked screen. After following couple of blogs online, added the following code: @interface MyControllerClass () <UIGestureRecognizerDelegate, UIApplicationDelegate> - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication]

Add custom controls to AVPlayer in swift

早过忘川 提交于 2020-01-18 22:41:20
问题 I am trying to create a table view such that I am able to play videos . I am able to do this using AVPlayer and layer. I want to add a custom play and pause button with a slider to the bottom of a video view. AVPlayerController comes built in with these controls. How can I implement these in AVPlayer. I have been looking for examples. But I haven't found any. Are there any GitHub examples or code samples that I can follow? Any help will be really appreciated. 回答1: here I add the points , you

Add custom controls to AVPlayer in swift

偶尔善良 提交于 2020-01-18 22:39:51
问题 I am trying to create a table view such that I am able to play videos . I am able to do this using AVPlayer and layer. I want to add a custom play and pause button with a slider to the bottom of a video view. AVPlayerController comes built in with these controls. How can I implement these in AVPlayer. I have been looking for examples. But I haven't found any. Are there any GitHub examples or code samples that I can follow? Any help will be really appreciated. 回答1: here I add the points , you

How to reference video in custom data model for AVPlayer

守給你的承諾、 提交于 2020-01-16 17:06:28
问题 I've managed to reference images for my custom data model which is used to show unique cells their different information. I've been able to do it for images, as it's a lot easier, I just have no clue how to do it for videos. My data model looks like this: fileprivate let data = [ CustomData(title: "Test", image: #imageLiteral(resourceName: "ss-1"), url: "this-will-be-a-local-url-in-cache-to-a-video"), CustomData(title: "Test2", image: #imageLiteral(resourceName: "done-button"), url: "this

How to reference video in custom data model for AVPlayer

社会主义新天地 提交于 2020-01-16 17:03:20
问题 I've managed to reference images for my custom data model which is used to show unique cells their different information. I've been able to do it for images, as it's a lot easier, I just have no clue how to do it for videos. My data model looks like this: fileprivate let data = [ CustomData(title: "Test", image: #imageLiteral(resourceName: "ss-1"), url: "this-will-be-a-local-url-in-cache-to-a-video"), CustomData(title: "Test2", image: #imageLiteral(resourceName: "done-button"), url: "this

AVPlayerLayer not playing video but the audio is good

核能气质少年 提交于 2020-01-16 10:13:04
问题 I have somewhat of a confusing problem. I declared these variables in my class: var audioPlayer = AVPlayer() var videoPlayer = AVPlayer() var videoLayer = AVPlayerLayer() I have these codes for adding the container of the videoPlayer: let aspectHeight = view.frame.width * 9/16 let viewFrame = CGRect(x: 5, y: 0, width: view.frame.width - 10, height: aspectHeight) let layerFrame = CGRect(x: 0, y: 0, width: view.frame.width - 10, height: aspectHeight) videoPlayerContainerView.frame = viewFrame

AVPlayerLayer not playing video but the audio is good

大憨熊 提交于 2020-01-16 10:11:39
问题 I have somewhat of a confusing problem. I declared these variables in my class: var audioPlayer = AVPlayer() var videoPlayer = AVPlayer() var videoLayer = AVPlayerLayer() I have these codes for adding the container of the videoPlayer: let aspectHeight = view.frame.width * 9/16 let viewFrame = CGRect(x: 5, y: 0, width: view.frame.width - 10, height: aspectHeight) let layerFrame = CGRect(x: 0, y: 0, width: view.frame.width - 10, height: aspectHeight) videoPlayerContainerView.frame = viewFrame