avplayer

Get AVPlayerItem track title with SwiftUI

前提是你 提交于 2020-08-05 13:31:51
问题 I'm trying to create a radio app, which streams audio from an http streaming. I'm trying to fetch the current playing track title from the streaming, but all I can find is deprecated methods. My model looks like this: struct RadioStreamer { let streamingURL: URL private let player: AVPlayer? private let playerItem: AVPlayerItem? init(streamingURL: URL) { self.streamingURL = streamingURL self.playerItem = AVPlayerItem(url: self.streamingURL) self.player = AVPlayer(playerItem: self.playerItem)

Moving slider getting jumpy while playing Avplayer in iOS

本秂侑毒 提交于 2020-07-20 05:45:26
问题 I am playing mp3 urls in Avplayer. It is working fine, and I am showing Slider for progress of the audio player. While trying to moving forward slider, It is getting jumpy. But audio seeking is working fine. Only slider UI getting jumpy. My code is /* ---------------------------------------------------- Player setup ------------------------------------------------------ */ func playerSetup(url:String) { do { let audioURL = url avPlayerItem = AVPlayerItem( url:NSURL( string:audioURL )! as URL

Xamarin.Forms Set video as splash screen

五迷三道 提交于 2020-07-06 20:20:33
问题 I am working on xamarin.forms shared project. I am facing problem in setting video as splash screen. I got reference from here. The problem I face is video player is initialized and doing its process and in that time, AppDelegate code returns first. so video is not displayed but its sound is coming. Is there anything I am missing ? Here I merged VideoController and VideoViewController of the sample. I only use VideoViewController and refer my video from Resources folder in SetMoviePlayer()

Xamarin.Forms Set video as splash screen

喜欢而已 提交于 2020-07-06 20:20:00
问题 I am working on xamarin.forms shared project. I am facing problem in setting video as splash screen. I got reference from here. The problem I face is video player is initialized and doing its process and in that time, AppDelegate code returns first. so video is not displayed but its sound is coming. Is there anything I am missing ? Here I merged VideoController and VideoViewController of the sample. I only use VideoViewController and refer my video from Resources folder in SetMoviePlayer()

Does setting the AVPlayerItem after creating the AVPlayer increase efficiency in iOS 13?

删除回忆录丶 提交于 2020-06-29 04:45:34
问题 In a WWDC 2016 video, Apple says create the AVPlayer without an AVPlayerItem, create the AVPlayerLayer, and then assign the AVPlayerItem to the AVPlayer. I got the above code from @matt's Programming iOS 10 book. In it he says: Apparently there is some sort of efficiency if you do things in this order. The reason, it turns out, is that when an AVPlayerItem is assigned to an AVPlayer that doesn't have and associated AVPlayerLayer, the AVPlayer assumes that only the audio track of the AVAssest

Swift 4 switch to new observe API

百般思念 提交于 2020-06-26 04:30:47
问题 I am having trouble with the new observe API in Swift 4. player = AVPlayer() player?.observe(\.currentItem.status, options: [.new], changeHandler: { [weak self] (player, newValue) in if let status = AVPlayer.Status(rawValue: (newValue as! NSNumber).intValue) { } } But I get an error Type of expression is ambiguous without more context. How do I fix it? Not sure about keyPath syntax. There is also a warning in extracting AVPlayerStatus in the closure above Cast from 'NSKeyValueObservedChange'

What is the default buffer size of AVPlayer?

二次信任 提交于 2020-06-25 09:44:46
问题 What is the default maximum and minimum buffer size of iOS AVPlayer? How to increasing its size for mp3 streaming? thank you 回答1: If your buffer size means playback buffer, then I believe this size is undocumented. This behaviour is provided by AVFoundation, quoted on Advances in AVFoundation Playback And we see that playback starts but then we quickly run into a stall because we didn't have enough buffer to play to the end. In that case, we'll go into the waiting state and re-buffer until we

What is the default buffer size of AVPlayer?

两盒软妹~` 提交于 2020-06-25 09:44:29
问题 What is the default maximum and minimum buffer size of iOS AVPlayer? How to increasing its size for mp3 streaming? thank you 回答1: If your buffer size means playback buffer, then I believe this size is undocumented. This behaviour is provided by AVFoundation, quoted on Advances in AVFoundation Playback And we see that playback starts but then we quickly run into a stall because we didn't have enough buffer to play to the end. In that case, we'll go into the waiting state and re-buffer until we

How to play AVPlayerItems immediately

為{幸葍}努か 提交于 2020-06-25 05:19:08
问题 I'm using AVPlayer which I connect to an remote URL via an AVPlayerItem . The problem is that I want to play the sound from the URL immediately and don't let the user wait for the AVPlayer to buffer. The thing is that if the remote URL's asset media is very short then it doesn't buffer for long at all but if the media is a bit longer it takes a while. Is there a way to skip the buffering process or at least shorten it substantially? 回答1: Swift 5 You just need to use the

I want to make a sound play starting from the 15th second [closed]

牧云@^-^@ 提交于 2020-06-18 11:59:10
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . Improve this question I want to make a sound play starting from the 15th second. How can I do it programmatically? Thanks! 回答1: As I can understand you are trying to start your audio not from the beginning. In this case: You need to use seekToTime import UIKit import AVFoundation class