avplayer

how to use AVQueuePlayer in AVPlayer

空扰寡人 提交于 2019-12-24 03:39:41
问题 currently i am using following codes to play song playerItem = [AVPlayerItem playerItemWithURL:[song valueForProperty:MPMediaItemPropertyAssetURL]]; [_avPlayer replaceCurrentItemWithPlayerItem:playerItem]; here i am using AVPlayer for playing audio files, but my requirement is need to play group (NSArray) of song continuously(currently player stop after playing one song).I heared about AVQueuePlayer but don't know how to use is it with avplayer if anyone know this please help me 回答1: Look at

How to play tracks from iPod music library with different volume than system volume?

ε祈祈猫儿з 提交于 2019-12-24 00:16:02
问题 How can I play music from the ipod music library (like user-defined playlists, etc.) at a different volume than the system volume? 回答1: This is for anyone who is trying to play music / playlists from the ipod music library at a different volume than the system volume. There are several posts out there saying that the [MPMusicPlayerController applicationMusicPlayer] can do this, but I have found that anytime I change the volume of the applicationMusicPlayer, the system volume changes too.

Issues with vertical video orientation in SKVideoNode using Swift

柔情痞子 提交于 2019-12-23 23:24:50
问题 The following code shows my video file in correct zPosition with the other elements I'm working with, creating a background video. The problem I'm having is that the vertical video (1080x1920 pixels) gets rotated 90 degrees counterclockwise, and is stretched to fit as a landscape video. How can I ensure correct orientation without sacrificing my need to use the SKVideoNode with zPosition? let videoNode: SKVideoNode? = { guard let urlString = Bundle.main.path(forResource: "merry", ofType: "mov

AVPlayer won't let me access URL

感情迁移 提交于 2019-12-23 22:56:04
问题 I am Attempting very simple Xcode OS X program with swift 4.0 - this program builds and runs but I'm getting errors accessing the URL video file. Probably related to privilege or security setting somewhere but can't figure out where. Here is my program under class ViewController: NSViewController: @IBOutlet var playerView: AVPlayerView! //var url: URL! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. // guard let url = URL(string: "https:/

Sync video in AVPlayerLayer and AVPlayerViewController

天大地大妈咪最大 提交于 2019-12-23 19:21:03
问题 I'm working with AVPlayer to show the playing video using a URL in it. There are 2 parts to it: 1. Firstly, I've embedded the AVPlayer to a view's sublayer using AVPlayerLayer , i.e. var player: AVPlayer? func configure() { let urlString = "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" if let url = URL(string: urlString) { self.player = AVPlayer(url: url) let playerLayer = AVPlayerLayer(player: self.player) playerLayer.frame = self.view.bounds self.view.layer.addSublayer(playerLayer)

AirPlay Meta Data on Apple TV from App (AVPlayer - MPVolumeView)

落爺英雄遲暮 提交于 2019-12-23 19:04:06
问题 I have my app successfully streaming an MP3 via AVPlayer. I implemented a MPVolumeView to pull in AirPlay support which works great but I notice that the title info on my apple tv, does not show anything from the streamed MP3 but rather just "Unknown" info. Is there anyway to control this info from the app or is this an issue caused by the MP3 being streamed? Any help would be much appreciated!! 回答1: I wanted to update this question in case someone else needed to control what is seen on their

Playing AVAudio from iPod Library while device is locked

好久不见. 提交于 2019-12-23 18:39:16
问题 Just a quick question. I've set up my program to be able to play AVAudioPlayer and AVPlayer in the background, which is working fine. I can play a song, lock my screen and the sound will continue to play. What I'm having trouble with is calling [AVPlayer play] whilst my screen is ALREADY locked. This ultimately results in no music being played. 回答1: You need to tell your player to listen for control events: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication

Why does Swift's AVPlayer loads the playerItem for twice on one play?

六眼飞鱼酱① 提交于 2019-12-23 18:24:21
问题 I'm using AVFoundation's AVPlayer for streaming external mp3 files. I have a counter on the back-end that counts how many times a file loaded. The only client for this service is only me and whenever I trigger to play the AVPlayer, the counter increases two which means AVPlayer makes the request twice. Is there a reason for this, or how can I prevent that from happening? Here is my code: @IBAction func listen(sender: UIButton) { let urlstring = "http://api.server.com/endpoint-to-mp3" let url

Change AVPlayerViewController background to album artwork objective-c iOS

大憨熊 提交于 2019-12-23 15:13:28
问题 Is it possible to change the background of an AVPlayerViewController instance when playing audio ? When I lock my device, I can see the music controls with album artwork correctly shown but when the AVPlayerViewController is shown in my app, I can only see the controls with a background representing QuickTime currently playing. Here is how I call it : [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; NSURL *url=[NSURL fileURLWithPath:clickedPath];

AVPlayer Questions, while Live Streaming (iOS)

怎甘沉沦 提交于 2019-12-23 13:11:12
问题 I have AVPlayer Questions. 1.How to control the volume of it? 2.How to know if the AVPlayer is reloading music because bad connection, do i have some inidication of it? 回答1: AVPlayer uses the system volume, so if you need to provide controls for this you can use MPVolumeView which gives you the slider for volume control. For audio fading, you can use an AVAudioMix . Here's some code: //given an AVAsset called asset... AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; id