avplayer

Is it possible to cache HLS segments with AVPlayer?

好久不见. 提交于 2019-12-20 08:28:58
问题 Root Problem​ Our video buffers a lot when seeking in iOS. It buffers quite a bit more than our web player which saves copies of the already watched segments in temp storage. ​Desired Solution​ Caching the video segments locally on the device's disk. We're fine with caching a single quality and always replaying it. ​Blocker​ We can't find a way to perform caching within AVFoundation/AVPlayer. What We've Tried 2 ways to intercept networking requests with AVPlayer. Conforming to

iOS 7 SDK not abiding background audio

人走茶凉 提交于 2019-12-20 08:21:37
问题 I have done a lot of research, both on Google and StackOverflow. All the answers I found do not work in iOS 7. I started writing fresh app in iOS 7 SDK with Xcode 5. All I'm trying to do is play audio in the app from a file stored in the app bundle (not from the Music library). I want to have audio played in background and controlled when screen is locked (in addition to Control Center). I set the APPNAME-Info.plist key, UIBackgroundModes , to audio . It is not handling things in the app

AVPlayer and MPMoviePlayerController differences [closed]

↘锁芯ラ 提交于 2019-12-20 08:21:33
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I am developing an iPhone application that needs to play videos. So far, I learned that there are at least two API's for achieving this; AVPlayer and MPMoviePlayerController . What are the main differences? 回答1: NOTE as of iOS9, Apple has deprecated the

IOS AVPlayer cannot disable closed captions

倾然丶 夕夏残阳落幕 提交于 2019-12-20 07:01:12
问题 I've created my own video player using AVPlayer and have gotten everything to work properly except for closed captions. I have a video I'm testing and I know for a fact the closed captions are not baked in. I can disable them in other video viewers. closedCaptionDisplayEnabled I have that property on the AVPlayer set to NO and have logged it to make sure it is set to no but the captions still appear. Does anyone know why this might be? 回答1: I disable subtitle by below code snippet let output

IOS AVPlayer cannot disable closed captions

岁酱吖の 提交于 2019-12-20 07:00:40
问题 I've created my own video player using AVPlayer and have gotten everything to work properly except for closed captions. I have a video I'm testing and I know for a fact the closed captions are not baked in. I can disable them in other video viewers. closedCaptionDisplayEnabled I have that property on the AVPlayer set to NO and have logged it to make sure it is set to no but the captions still appear. Does anyone know why this might be? 回答1: I disable subtitle by below code snippet let output

How to play video with cookies content in iOS using AVPlayer in Swift?

二次信任 提交于 2019-12-20 06:48:41
问题 I have used the below implementation to play a video with cookies content from the server, but it shows play icon with cross line. I have refer the link and do following implementation in swift. but I didn't get any output :( func showVideo(url: String) { let videoURL = NSURL(string: url) var cookiesArray = [HTTPCookie]() guard let cookieArray = UserDefaults.standard.array(forKey: Constants.Object.kCookie) as? [[HTTPCookiePropertyKey: Any]] else { return } for cookieProperties in cookieArray

How to stream remote audio in iOS 13? (SwiftUI)

岁酱吖の 提交于 2019-12-20 05:26:16
问题 This code using AVPlayer works only on Playground import AVFoundation var player = AVPlayer() let playerItem = AVPlayerItem(url: URL(string: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")!) player = AVPlayer(playerItem: playerItem) player.play() When I tried to run it on my SwiftUI App on my physical device, using this code: Button(action:{ var player = AVPlayer() let playerItem = AVPlayerItem(url: URL(string: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")!

iOS - Detecting if an URL stream is working or not, with AVPlayer

这一生的挚爱 提交于 2019-12-20 04:31:30
问题 This is how in my code, playing from url, looks like: private func play() { let streamUrl = ... let playerItem = AVPlayerItem(url: streamURL) radioPlayer = AVPlayer(playerItem: playerItem) radioPlayer.volume = 1.0 do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, with: AVAudioSessionCategoryOptions.mixWithOthers) try AVAudioSession.sharedInstance().setActive(true) UIApplication.shared.beginReceivingRemoteControlEvents() } catch { print("Error deactivating

AVPlayer Volume Control

独自空忆成欢 提交于 2019-12-19 18:50:23
问题 I want to create a button that mutes the audio from an AVPlayer. Why can´t I use .volume with AVPlayer, only with AVAudioPlayer? Is there another way to change the volume? e.g music.volume = 0.0; Thanks for your answers. 回答1: Starting in iOS 7, simply call: myAvPlayer.volume = 0; Otherwise, you'll have to use the annoying setAudioMix solution. I'm detecting support for this in my app as follows: if ([mPlayer respondsToSelector:@selector(setVolume:)]) { mPlayer.volume = 0.0; } else { NSArray

AVPlayer Volume Control

若如初见. 提交于 2019-12-19 18:49:32
问题 I want to create a button that mutes the audio from an AVPlayer. Why can´t I use .volume with AVPlayer, only with AVAudioPlayer? Is there another way to change the volume? e.g music.volume = 0.0; Thanks for your answers. 回答1: Starting in iOS 7, simply call: myAvPlayer.volume = 0; Otherwise, you'll have to use the annoying setAudioMix solution. I'm detecting support for this in my app as follows: if ([mPlayer respondsToSelector:@selector(setVolume:)]) { mPlayer.volume = 0.0; } else { NSArray