avplayer

AVPlayerViewController inside a view is not showing the playback controls

时光总嘲笑我的痴心妄想 提交于 2019-12-06 10:29:51
问题 I am working with apple tv. I have a UIView inside my UIViewController. I am adding AVPlayerViewController as subview of my UIView. UIView's frame is CGRect(x: 50, y: 50, width: 1344, height: 756). I am setting AVPlayerViewController frame equals to my UIView's frame. Issue is that video plays fine in its frame but the controls like pause, play, forward etc. are hidden and not working. But when I set frame as CGRect(x: 0, y: 0, width: 1920, height: 1080), controls are visible and working. My

Getting averagePowerForChannel in AVPlayer

ε祈祈猫儿з 提交于 2019-12-06 10:28:05
问题 how can i get the averagePowerForChannel in AVPlayer in order to make an audio visualization on my music app! ive already done the visualization part but im stuck in its engine (realtime volume channel). i know that by using AVAudioPlayer it can be done easily using the .meteringEnabled Property but for some known reason AVPlayer is a must in my app! im actualy thinking of using AVAudioPlayer Alongside with AVPlayer to get the desired result but it sounds kind of messy workaround, how can

AVPlayer exit fullscreen on finish playing

别说谁变了你拦得住时间么 提交于 2019-12-06 09:48:56
I am using a AVPlayer to show some video streams (with a fixed length). The problem is when the content is finished the player (if it has been set to fullscreen by the user) still remains in fullscreen. Any way to make the player go to it's minimized state immediately after the content is finished playing? To add on to longilong's answer, You could dismiss the video player with dismissViewControllerAnimated in the itemDidFinishPlaying function. You should also remember to remove the observer you created after you are done. -(void)startPlaybackForItemWithURL:(NSURL*)url { // First create an

Unable to get tracks of AVAsset using HLS while retrieveing bitrate

回眸只為那壹抹淺笑 提交于 2019-12-06 09:25:07
问题 I am using HLS streaming in my application and I am using AVPlayer. Now I want to get bitrate of the video track using AVAsset. Although I have added observer and other stuff I am getting tracks array as empty always.Am I on right track or missing anything? 回答1: HLS is adaptive, therefore, bitrate can vary across the duration of the stream based on various conditions. You are on completely the wrong track, unlike playing a file, either local or from a network URL, currentItem.asset.tracks

Live Streaming in Swift

廉价感情. 提交于 2019-12-06 06:46:46
问题 I need to create a live streaming application in SWIFT Tried many ways using AVFoundation framework (AVPLayer & AVPlayeritem) but didn't work It's audio only so I don't want to do it in the webview way. Thanks in advance 回答1: You might try leveraging the VideoCore library that wraps these frameworks into a complete streaming package. With this package, you can readily start publishing with little effort. Take the following for consideration (replicated from their example projects): To

iOS Multiple AVPlayer objects results in loss of audio/video sync

﹥>﹥吖頭↗ 提交于 2019-12-06 05:45:33
问题 I've been trying to use two different AVQueuePlayer objects within my app. The first player plays a series of short video clips streamed over the net. The second object plays only one video, but it is much longer in length. It is also streamed. I have verified all the clips have proper audio/video sync. What I've noticed is that if I create one AVPlayer object after having created another one beforehand, the audio/video sync in the second player is lost. The audio is played between about

Record audio streamed from AVPlayer

断了今生、忘了曾经 提交于 2019-12-06 05:34:05
问题 I'm trying to record/capture audio that's being streamed via an AVPlayer . The AVAudioRecorder only records from the microphone which may work if the audio is played via speakerphone (although quality will suffer) but it'll definitely not work if the headphones are plugged in. I've looked everywhere for a solution but still haven't found a solution that'll work for me. Would I need to grab the audio buffer? Is there another way to capture what's being played? 回答1: You can grab audio buffers

AVPlayer blank video: playing sound but no video

余生长醉 提交于 2019-12-06 04:27:31
This question has the same problem, but the solutions didn't work. The AVPlayer sometimes plays a blank video: there is sound but no video. While blank videos were played, we printed the frame and status of the player. The frame was non-zero and was correctly set. The status was also readyToPlay . The play function is also invoked on the main thread. In other words, the frame for the player layer is valid, and the player is also ready to play. Yet no video appears, even though sound does. The issue seems to be a timing one. If we wait 5-10 seconds before playing the video, the video works fine

AVPlayer doesn't play more than one time

安稳与你 提交于 2019-12-06 02:02:04
I have some strange problem with playing audio through AVPlayerItem & AVPlayer. I have recorder and iPod item picker, stream from both of them are going through code like this: AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil]; [audioSession setActive:YES error:nil]; _playerItem = [[AVPlayerItem alloc] initWithURL:_soundFileURL]; _player = [[AVPlayer alloc] initWithPlayerItem:_playerItem]; [_player play]; Everything is actually ok, except one thing, I can't play this stream second or more time. It's just stopped,

How to play a video from URL with no file extension in iOS?

拥有回忆 提交于 2019-12-06 00:48:56
问题 I need to play a video at this url: http://ep-lin-upload.s3.amazonaws.com/vupl_lin/F64/CDF/F64CDF3B0348471E95C244DE2DDDD3F3 The mime type of the video is: video/mp4 NSURL *adURL = [NSURL URLWithString:@"http://ep-lin-upload.s3.amazonaws.com/vupl_lin/F64/CDF/F64CDF3B0348471E95C244DE2DDDD3F3"]; AVPlayer *player = [AVPlayer playerWithURL:adURL]; This code works for urls with file extension. However, AVPlayer does not recognise the mime type if there is no file extension I think. How can I get