avplayer

Playing audio file while I download it

随声附和 提交于 2020-01-14 16:32:27
问题 I am trying to play partially downloaded file (I want the audio to start when it has enough downloaded data). I have tried the following: self.mutableData = nil; self.mutableData = [NSMutableData data]; self.mutableData.length = 0; GTMHTTPFetcher *fetcher = [[self driveService].fetcherService fetcherWithURLString:song.filePath]; [fetcher setReceivedDataBlock:^(NSData *dataReceivedSoFar) { [self.mutableData appendData:dataReceivedSoFar]; if (!self.audioPlayer.playing && self.mutableData.length

Playing Audio From Parse.com

自作多情 提交于 2020-01-13 19:51:30
问题 I am trying to play an audio file i saved on parse. I am getting the url from the PFFile from the object i saved to parse. When i run the app the avplayer produces no audio. I tested to see if the avplayer was playing by the first code snippet below and it prints out "Playing" which means the player is playing but no audio. I also tried setting the volume for avplayer and that didn't help. Don't understand why it won't play if anyone would like to help me out. Audio File URL: http://files

Playing Audio From Parse.com

落花浮王杯 提交于 2020-01-13 19:51:15
问题 I am trying to play an audio file i saved on parse. I am getting the url from the PFFile from the object i saved to parse. When i run the app the avplayer produces no audio. I tested to see if the avplayer was playing by the first code snippet below and it prints out "Playing" which means the player is playing but no audio. I also tried setting the volume for avplayer and that didn't help. Don't understand why it won't play if anyone would like to help me out. Audio File URL: http://files

Accessing multiple audio hardware outputs/channels using AVFoundation and Swift

喜欢而已 提交于 2020-01-12 11:12:39
问题 How do I access additional audio hardware outputs other than 1-2 using AVFoundation? I'm writing swift code for a Mac OS-X app which plays mp3 files through various output devices (USB interface, dante, soundflower) which looks like the following: myPlayer = AVPlayer(URL: myFilePathURL) myPlayer.audioOutputDeviceUniqueID = myAudioOutputDevices[1].deviceUID() myPlayer.play() But, I'm not sure how to play the audio file to channels other than just 1-2. For instance I'd like to play an mp3 to

How to play youtube video using URL in AVPlayer IOS?

十年热恋 提交于 2020-01-12 08:24:43
问题 I want to load video in AVPlayer using YouTube URL but it is not showing anything.Whenever i am loading from a local storage using NSBundle it is working fine.Is there is any alternative to load video or we can do something in AVPlayer. This is my code: - (void)viewDidLoad { [super viewDidLoad]; NSError *setCategoryError = nil; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error: &setCategoryError]; AVAsset *asset = [AVAsset assetWithURL:[NSURL fileURLWithPath:@

AVPlayer currentTime update for a UISlider when ViewController load

此生再无相见时 提交于 2020-01-12 07:24:29
问题 I'm playing songs in AVPlayer . I have created a separate view controller for my media player and initialization, and all the methods that I'm using for the player (play, pause, repeat, shuffle) are there in the same view controller. I update a slider like this: [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(sliderUpdate:) userInfo:nil repeats:YES];` - (void) sliderUpdate:(id) sender{ int currentTime = (int)((song.player.currentTime.value)/song.player.currentTime

AVPlayer currentTime update for a UISlider when ViewController load

为君一笑 提交于 2020-01-12 07:24:08
问题 I'm playing songs in AVPlayer . I have created a separate view controller for my media player and initialization, and all the methods that I'm using for the player (play, pause, repeat, shuffle) are there in the same view controller. I update a slider like this: [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(sliderUpdate:) userInfo:nil repeats:YES];` - (void) sliderUpdate:(id) sender{ int currentTime = (int)((song.player.currentTime.value)/song.player.currentTime

AVPlayer.play() in UITableViewCell briefly blocks UI

早过忘川 提交于 2020-01-12 03:55:12
问题 I’m trying add inline videos to my UITableViewCells a la Instagram, Twitter, Vine…etc. I’m testing out the UI with a local video file using AVPlayerController and a custom cell (see sample code below). I wait for the status of the AVPlayer to be ReadyToPlay and then play the video. The issue is that when scrolling on the tableView the UI freezes for a fraction of section whenever a video cell is loaded which makes the app seem clunky. This effect is made worse when there are multiple video

App with AVPlayer plays mp4 interrupt iPod music after launched

删除回忆录丶 提交于 2020-01-11 06:13:49
问题 My App plays mp4 using AVPlayer, when my application finish launching, it interrupt the iPod music, although I have set the audio session to allow mix with others in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AudioSessionInitialize(NULL, NULL, NULL, NULL); AudioSessionSetActive(true); UInt32 sessionCategory = kAudioSessionCategory_AmbientSound; AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof

How to check if AVPlayer has Video or just Audio?

爱⌒轻易说出口 提交于 2020-01-11 05:05:09
问题 I try to play some "media" but at the time the AVPlayer starts I don't know if it is audio or Video. I connected the player Layer and it works fine. self.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:[[PCPlayerManager sharedManager] audioPlayer]]; avPlayerLayer.videoGravity = AVLayerVideoGravityResizeAspect; avPlayerLayer.frame = CGRectMake(0, 0, videoView.frame.size.width, videoView.frame.size.height); [videoView.layer addSublayer:avPlayerLayer]; But how can I check if there is Video