avplayer

AVPlayer - Fast Backward / Forward Stream

≯℡__Kan透↙ 提交于 2019-12-12 15:20:35
问题 This is my code in the viewDidLoad : AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://groove.wavestreamer.com:7321/listen.pls?sid=1"]]; [playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil]; music = [[AVPlayer playerWithPlayerItem:playerItem] retain]; [music play]; My question: How can I create a button, that fast-forwards / fast-backwards the stream 5 seconds, when it´s pressed? Thank you for your

how to display selected songs from ipodLibrary played from avplayer in uitableview

旧城冷巷雨未停 提交于 2019-12-12 14:41:55
问题 I am playing songs by using AVPlayer. I am able to play it in background as well. There is a UIButton called showPlaylist . When I tap on it I need to display list of songs which I have selected from ipodLibrary in UITableView and I should be able to display artwork, number of mins remaining in the song and the artist's name if it is available in the song. I have play and pause buttons: when I click the pause button, the song is paused but when I tap on the play button again, it goes to the

Android recorded aac(.mp3) file not playing in iOS

偶尔善良 提交于 2019-12-12 14:27:22
问题 Hi I'm using the following code to record audio on Android myRecorder = new MediaRecorder(); myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); myRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); myRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); myRecorder.setAudioSamplingRate(44100); myRecorder.setAudioEncodingBitRate(256); myRecorder.setAudioChannels(1); voiceFileName = getFilename(); myRecorder.setOutputFile(voiceFileName); private String getFilename() { String

Detecting Current Item in AVQueuePlayer and Knowing when it Changes?

岁酱吖の 提交于 2019-12-12 13:50:10
问题 I currently have an AVQueuePlayer playing a few .aif files in sequence. As it goes through each audio I want to perform an action related to that specific sound (for example changing an imageview's uiimage). My problem is setting the NSNotification correctly. I've set it to notify me when the queue finished with the last object, but I'm having trouble receiving an a notification for each current item. Here is what I have: //Setting Up My Queue List yellowVoice = [[AVPlayerItem alloc]

“CIImage initWithCVPixelBuffer:options:” failed because its pixel format p422 is not supported in iOS 10

喜欢而已 提交于 2019-12-12 13:15:42
问题 In ios10 , I want to get video capture, but get an error "[CIImage initWithCVPixelBuffer:options:] failed because its pixel format p422 is not supported." My code is this: func previewImage(handle: (image: UIImage?) -> Void) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in dispatch_async(dispatch_get_main_queue(), { () -> Void in guard let time = self.player?.currentTime() else { return } guard let pixelBuffer = self.output?

Using Swift with AVPlayer, how do you add and remove a video via code?

不羁岁月 提交于 2019-12-12 12:50:23
问题 I'm new to Swift and am trying to add a video to the view and then remove it when my "stopScreenSaver" notification is dispatched. All seems to work well except for when I go to remove the video layer (playerLayer.removeFromSuperlayer()). Any guidance would be appreciated. I feel like I'm missing some basic concept here for adding and removing the layer! import UIKit import AVFoundation import QuartzCore import CoreMedia class ViewController: UIViewController { let contentURL = NSBundle

AVPlayer Closed Captions turn on/off

两盒软妹~` 提交于 2019-12-12 12:26:22
问题 I'm creating custom video player, and i want to create toggle button for CC. I saw this post : IOS AVPlayer cannot disable closed captions So I tried : AVMediaSelectionGroup *group = [self.avPlayer.currentItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; [self.avPlayer.currentItem selectMediaOption:nil inMediaSelectionGroup:group]; Didn't work.. cc still visible. also tried : AVPlayerItemLegibleOutput *output = [[AVPlayerItemLegibleOutput alloc] init];

Detect tap on / off AVPlayerViewController controls

可紊 提交于 2019-12-12 11:56:50
问题 Based on the answer from this question, I have implemented an event handler that detects when an AVPlayerItem finishes 'naturally'(through AVPlayerItem.DidPlayToEndTimeNotification ) and when it finishes because the user has used the seek bar to reach the end of the video (through AVPlayerItem.TimeJumpedNotification ). I would like to extend this further by checking, in the event handler for the second case, whether the user has stopped seeking - i.e their finger has been lifted from the

addPeriodicTimeObserverForInterval called extra time

老子叫甜甜 提交于 2019-12-12 11:23:06
问题 I have a AVPlayer with 4 sec video ( NSTimeInterval duration = CMTimeGetSeconds(self.playerItem.asset.duration) = 4). I'd like to update UI with changes: self.periodicTimeObserver = [self.player addPeriodicTimeObserverForInterval:CMTimeMake(1, 1) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) { [weakSelf currentTimeDidChange:CMTimeGetSeconds(time)]; }]; But for some reasons I get extra calls to UI: - (void)currentTimeDidChange:(NSTimeInterval)currentTime { NSLog(@"timePassed %f,

iOS AVPlayer cancel buffering

笑着哭i 提交于 2019-12-12 10:58:08
问题 If I load an AVPlayer with a file from a host with [AVPlayer playerWithPlayerItem:playerItem]; And the " buffering " takes longer than the user wants, how do I allow them to cancel it? 回答1: So the correct answer is @Che with: If you will call [self.player replaceCurrentItemWithPlayerItem:nil]; buffering stops. – Che Oct 13 at 14:36 and you do so on the observer listening for the status update from the playerWithPlayerItem. Thanks All! 回答2: I don't think there is a method to directly stop