avplayer

Switching between headphone & speaker on iPhone

ぃ、小莉子 提交于 2019-12-11 04:42:19
问题 I am trying to set up the audio routing for an iPhone app outputting. I am using a route change listener to detect when the audio route has changed. The listener detects the changes, such as when the headphones are plugged in and out. By default, the speaker plays audio and then I plug my headphones in and the audio transmits through the headphones fine. From there, any changes do not occur, even though the route change listener is detecting them. Any help would be really appreciated. NSError

Yet another - “Unrecognized Selector Sent to Instance” issue

牧云@^-^@ 提交于 2019-12-11 03:56:41
问题 I've looked at each posted question on this topic, but none give me a solution. My project replicates to a large extent the AVPlayer demo app in the dev library (minus the scrubbing capabilities): I have a copy and paste AVPlayerDemoPlaybackView class (renamed YOPlaybackView ) and an associated controller, along with a very similar xib (minus the scrubber). My view controller code follows very closely the pattern in the demo (code differences only posted below for brevity). I have ensured the

AVPlayer: AirPlay button shows up in control center even though allowsExternalPlayback is set to NO

耗尽温柔 提交于 2019-12-11 02:49:47
问题 I've got an instance of AVPlayer which plays some media, but I don't want user to be able to stream it via AirPlay. So I set allowsExternalPlayback property of AVPlayer to NO . However it doesn't seem to affect AirPlay button in control center, so it stays visible. Is there any way to hide the button? 来源: https://stackoverflow.com/questions/30755169/avplayer-airplay-button-shows-up-in-control-center-even-though-allowsexternalpl

iOS play video without audio session

こ雲淡風輕ζ 提交于 2019-12-11 02:27:56
问题 I am trying to play a short video in my app using either a MPMoviePlayerController or an AVPlayer . The problem is (since my video doesn't have any sound) that I do not want to interfere with the sounds being played by other apps in the background. I tried to play with AVAudioSession : AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryAmbient withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil]; [audioSession setActive

AVPlayer plays on simulator but doesn't on a real device

风流意气都作罢 提交于 2019-12-11 02:09:52
问题 I'm implementing a basic audio player in order to play remote audio files. Files are in format mp3. The code I wrote is working fine on the simulator but doesn't work on a real device. However the same url I use within my app works fine if I load it by using safari (on the same real device) so I'm not really getting the missing point. Below is my code: self.musicPlayer = [AVPlayer playerWithURL:[NSURL URLWithString:urlTrack]]; [self.musicPlayer play]; something extremely easy. The music

HLS video is not playing on simulator and real device

喜你入骨 提交于 2019-12-11 02:05:14
问题 I am working on an iOS app that simply plays the live stream HLS video. My issue is that I have used AVPlayer and view controller to set up the playground, All things are working fine the view controller is started, the player is also started but the streaming doesn't start. The stream is a type of .m3u8 that works extremely fine in safari and chrome. The iOS doesn't show me up the video either on simulator or real-device. I have also searched for other SO solutions but neither of them worked

AVPlayer Live stream how to get power for audio level metering

ぐ巨炮叔叔 提交于 2019-12-11 01:11:58
问题 I am trying to show a meter graph in my app which uses AVPlayer to stream live audio streams. I know for AVAudioPlayer there is a way as per: Trying to understand AVAudioPlayer and audio level metering which uses peakPowerForChannel But AVAudioPlayer doesn't work for audio streams. Is there something similar for AVPlayer? Or is there any other way I can get the power values from the AVPlayer? Code: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; if

Determine size/aspect ratio of video for SKVideoNode in SceneKit

陌路散爱 提交于 2019-12-11 00:27:55
问题 How can I get the video size of a video from AVPlayer to set the geometry size of my node? For example, I have an SCNPlane with a width and height let planeGeo = SCNPlane(width: 5, height: 5) So now I instantiate my video player let videoURL = NSURL(string: someURL) let player = AVPlayer(URL: videoURL!) and my SKVideoNode let spriteKitScene = SKScene(size: CGSize(width: 1920, height: 1080)) spriteKitScene.scaleMode = .AspectFit videoSpriteKitNode = SKVideoNode(AVPlayer: player)

How to get AVPlayer to redraw current AVItem videoComposition when paused

会有一股神秘感。 提交于 2019-12-11 00:27:29
问题 I'm building a simple video editor for macOS: A movie file is loaded as an AVAsset, transformed by a series of CIFilters in a AVVideoComposition, and played by an AVPlayer. I present UI controls for some of the parameters of the CIFilters. When video is playing everything is working great, I slide sliders and effects change! But when the video is paused the AVPlayerView doesn't redraw after the controls in the UI are changed. How can I encourage the AVPlayerView to redraw the contents of the

How to get an MP3 bit rate in SWIFT

∥☆過路亽.° 提交于 2019-12-10 23:08:47
问题 I am searching for a way of getting an mp3 bitrate like 128kbps or 320kbps for mp3 audio from url link. I have a UITableView that loads a list of files from url list, and I would like to display an audio quality. I have tried using AVAudioPlayer and AVPlayer but no luck. Please help, how can I achieve this? do{ let audioPlayer = try AVAudioPlayer(contentsOf:audioURL) print(audioPlayer.settings) if #available(iOS 10.0, *) { print(audioPlayer.format) } else { // Fallback on earlier versions }