avplayer

SeekToTime in AVPlayer stops playing streaming audio, when forward

谁说胖子不能爱 提交于 2019-12-19 03:16:22
问题 I am streaming audio by using AVPlayer. It is working well. But Now i need to make a slider to move audio forward and backward, like typical music player. I used the function seekToTime which works great with local audio file. But when i stream song from web url, the function stops audio when I forward slider with a large range. My guess is that the song is being downloaded and if i move slider forward with large range then may be system has not downloaded the song data packets for that time,

AVAudioPlayer rate

老子叫甜甜 提交于 2019-12-19 03:12:20
问题 So I'm trying to play a sound file at a different rate in iOS 5.1.1, and am having absolutely no luck. So far I have tried setting the rate of the AVAudioPlayer: player = [[AVAudioPlayer alloc] initWithContentsOfURL:referenceURL error:&error]; player.enableRate = YES; player.rate = 1.5; player.numberOfLoops = 0; player.delegate = self; [player prepareToPlay]; [player play]; with no luck at all, the sound plays but just ignores the rate I give it. I have also tried AVPlayer: avPlayer = [

AVPlayer plays video composition result incorrectly

末鹿安然 提交于 2019-12-18 17:49:20
问题 I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@"

AVPlayer plays video composition result incorrectly

房东的猫 提交于 2019-12-18 17:49:14
问题 I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@"

How to connect the audio to bluetooth when playing using AVPlayer

六月ゝ 毕业季﹏ 提交于 2019-12-18 13:01:27
问题 I am playing the audio from an url using AVPlayer, but when the iPhone is connected to a Bluetooth device it is not playing via Bluetooth, how to play via Bluetooth if it is connected, i see some posts in SO, but none of those are clearly explained. Below is my code. -(void)playselectedsong{ AVPlayer *player = [[AVPlayer alloc]initWithURL:[NSURL URLWithString:urlString]]; self.songPlayer = player; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:

Caching with AVPlayer and AVAssetExportSession

纵饮孤独 提交于 2019-12-18 11:13:55
问题 I would like to cache progressive-download videos using AVPlayer. How can I save an AVPlayer's item to disk? I'm trying to use AVAssetExportSession on the player's currentItem (which is fully loaded). This code is giving me " AVAssetExportSessionStatusFailed (The operation could not be completed) " : AVAsset *mediaAsset = self.player.currentItem.asset; AVAssetExportSession *es = [[AVAssetExportSession alloc] initWithAsset:mediaAsset presetName:AVAssetExportPresetLowQuality]; NSString *outPath

AVPlayerItem replaceCurrentItemWithPlayerItem Blocking

谁说我不能喝 提交于 2019-12-18 10:41:15
问题 First a little context about the application... - There's a lot of heavy UI operation's involving video players (mostly scrolling) - The videos are dynamic and change based on our current page . - so the video's have to be dynamic and keep changing and also the UI needs to be responsive I was initially using a MPMoviePlayerController but then due to certain requirements i had to fall back on the AVPlayer I made my own wrapper for the AVPlayer . To change the content in the videoPlayer this is

Multiple videos with AVPlayer

假如想象 提交于 2019-12-18 09:56:06
问题 I am developing an iOS app for iPad that needs to play videos in some part of the screen. I have several video files that needs to be played after each other in an order that is not given at compile time. It must looks as if it is just one video playing. It is fine that when going from one video to the next that is some delay where the last or first frame of the two videos are shown, but there should be no flickering or white screens with no content. The videos does not contain audio. It is

Updating AVPlayerItem video composition

倾然丶 夕夏残阳落幕 提交于 2019-12-18 09:09:07
问题 Me and my team are stuck on an issue for a few days now. We have AVPlayer which plays AVPlayerItem with a custom AVVideoComposition . player.currentItem?.videoComposition = getUpdatedVideoComisition() The user can decide if to remove or keep the composition. I'm trying to remove the composition by calling player.currentItem?.videoComposition = nil But in an unexpected way even when assigning nil to the videoComposition property, it's keep on playing with the same composition. How can we

Playing video from within app?

六月ゝ 毕业季﹏ 提交于 2019-12-18 08:59:16
问题 I am trying to play a local video from my app using AVPlayer. I have looked everywhere but can't find any useful tutorials/demos/documentation. Here is what I am trying, but it is not playing. Any idea why? The URL is valid because I was using the same one to play a video using MPMoviePlayer successfully. Video *currentVideo = [videoArray objectAtIndex:0]; NSString *filepath = currentVideo.videoURL; NSURL *fileURL = [NSURL fileURLWithPath:filepath]; AVURLAsset *asset = [AVURLAsset