avplayer

How many AVPlayers are allowed to be created at the same time?

走远了吗. 提交于 2020-01-11 02:26:07
问题 I have a collectionView and each cell has an AVPlayer which is set to play. So every cell is playing a video at the same time. It seems that iOS only allows you to play 16 videos at the same time. For example, look at my sample app below. Out of 50 cells , only 16 started playing a video. This number always stays the same. This happens on a iPhone 6s running iOS 10. In the Xcode simulator however all 50 videos start playing. This issue only happens on an actual device. Also, I get these two

MPMoviePlayer in iOS 9

两盒软妹~` 提交于 2020-01-10 04:47:16
问题 i have made a function in iOS 8 to play a movie in the background and now when i want to use it in iOS 9 it gives me a warning and says that it best not to use MPMoviePlayer and instead use AVPlayer. but i don't know anything about AVPlayer. how can i convert this to a proper function without warning that uses AVPlayer instead of MPMoviePlayer? heres the func : func playVideo() ->Bool { let path = NSBundle.mainBundle().pathForResource("video", ofType:"mov") //take path of video let url =

How to detect fullscreen mode using AVPlayerViewController in Swift?

两盒软妹~` 提交于 2020-01-10 03:11:21
问题 I am trying to detect when the AVPlayerViewController is in full-screen mode, but I'm having a difficult time achieving this. I'd like to know when the user selects the expand button to enter full screen as shown here: I've added the appropriate observer per these suggestions: Detect Video playing full screen in Portrait or landscape How to detect fullscreen mode of AVPlayerViewController The appropriate code: var avWidth:CGFloat = 375 var avHeight:CGFloat = 300 override func viewDidLoad() {

LockScreen Player is not appearing once the screen is locked in actual device.

无人久伴 提交于 2020-01-06 07:01:13
问题 I'm new to swift and I have a AVPlayer which is playing fine on a particular screen. My objective is to play the same audio on lock-screen mode. So far this is what I have done and the code as bellow. for some reason I don't see the player widget on lock-screen mood at all. What am I doing wrong here. class MyAudiosViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,AVAudioPlayerDelegate { @IBAction func playButtonPressed(_ sender: Any) { if(currentRowSelected != nil ){

Playing custom .opus audio file in iOS

被刻印的时光 ゝ 提交于 2020-01-06 05:36:08
问题 I was able to record and play opus using AVFoundation. The problem is I got a custom opus audio file (coming from server, also processed in server) as follows: | header 1 (1 byte) | opus data 1 (1~255 bytes) | header 2 (1 byte) | opus data 2 (1~255 bytes) | ... | ... | Each header indicates size of the opus data i.e. if header 1 is 200 (Int) then opus data 1 is 200 bytes So, I am extracting opus data and appending to Data buffer as following: guard let url = Bundle.main.url(forResource: "test

iPod - Let the native music app to play sound in background

倖福魔咒の 提交于 2020-01-06 05:35:08
问题 I am building an application for iPod. When running it, the native iPod music app should continue play in background, but this is not happening. I think it might have something to do with the sound that it is played by my app. For playing a short sound at a certain point, I am using AVAudioPlayer. The code looks like this: NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"mp3"]; NSLog(@"%@", path); player = [[AVAudioPlayer alloc] initWithData:[NSData

How to choose next song in remoteControlledEvents

二次信任 提交于 2020-01-06 02:58:26
问题 I am using AVPlayer where I can control play, pause function by double tapping home button or in technical terms remoteControlledEvents . I was wondering how to implement it so I can go to the next track in remoteControlledEvents . Thanks -(void)remoteControlReceivedWithEvent:(UIEvent *)event { switch (event.subtype) { case UIEventSubtypeRemoteControlTogglePlayPause: if (avplayer.rate == 0.0) { [avplayer play]; } else { [avplayer pause]; } break; case UIEventSubtypeRemoteControlPlay:

How to choose next song in remoteControlledEvents

北城以北 提交于 2020-01-06 02:58:08
问题 I am using AVPlayer where I can control play, pause function by double tapping home button or in technical terms remoteControlledEvents . I was wondering how to implement it so I can go to the next track in remoteControlledEvents . Thanks -(void)remoteControlReceivedWithEvent:(UIEvent *)event { switch (event.subtype) { case UIEventSubtypeRemoteControlTogglePlayPause: if (avplayer.rate == 0.0) { [avplayer play]; } else { [avplayer pause]; } break; case UIEventSubtypeRemoteControlPlay:

Seamless looping Video using AVPlayer- Swift

混江龙づ霸主 提交于 2020-01-04 06:34:14
问题 I am using AVPlayer to play local video in background using loop and video is playing fine but after finishing video it takes pause to play video in loop. I have tried many methods and also seen many post on stack overflow but i failed to find appropriate solution. I am using Swift3. Code is here : var videoplayer :AVPlayer = AVPlayer() override func viewDidLoad() { super.viewDidLoad() let path = Bundle.main.path(forResource: "background4", ofType: "mp4") videoplayer = AVPlayer(url: URL

iOS 10 AVPlayer will not stream video from URL with no extension and with video/mp4 as content type

泪湿孤枕 提交于 2020-01-02 06:13:28
问题 Currently, we are using a standard AVPlayer via AVPlayerViewController to play video. We are streaming video from a url in the format https://ourdomain/media/mediaid?jwt=authTokenHere. The url, as you can see, has no extension; however the headers are being set on the payload to indicate that the response is a video. Though the links results in the video playing fine in desktop Safari and Chrome, it will not play via iOS's AVPlayer in our application. Is there some particular format that