avplayer

AVplayer not showing in ScrollView after 2-3 times

天大地大妈咪最大 提交于 2019-12-06 16:38:27
I am adding multiple AVPlayer objects in a scrollview. For the first time this is working fine but as i go back to my previous view and come back again i am not able to see AVPlayer objects in scrollView. I need as matrix of multiple AVPlayer to show thumbnails of my videos. Please help me asap Thanks in advance. I had a similar problem and after a lot of searching discovered that the AVPLayerItem object causes this issue. Basically when the AVPlayer items go offscreen you need to make sure everything is released properly, and then recreate everything when they come back on screen. As part of

Resume AVPlayer stream playback last sample

怎甘沉沦 提交于 2019-12-06 16:12:50
I am trying to use the native player (AVPlayer) to reproduce a live stream on iOS. However, I have trouble resuming the playback. When I stop the playback and resume it after few seconds, the playback starts from the moment I paused instead of reproducing the current (last) sample of the live stream. Is there a way to get the last sample, o configure AVPlayer to reproduce from last sample when tapping on Play Button? My solution is based on denying user to keep the player paused. This is, destroying the player each time playback is resumed. And creating a new instance each time, playback is

AVPlayer on left side of cell works perfectly. AVPlayer on right side of cell does not work

点点圈 提交于 2019-12-06 15:43:33
I have UITableView cells, each with 2 AVPlayers. One on the right side, and one on the left side. And to go along with this, 2 AVPlayerLayers, 2 AVPlayerItems, etc. Exact same setup on each side of the cell. Except, the video on the right side of the cell does not play. Here is the code that plays the video just perfectly on the left side: - (void)playVideoOnLeftFromCache:(CompletedTableViewCell *)videoCell { videoCell.contentView.backgroundColor = [UIColor clearColor]; videoCell.redView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, (videoCell.frame.size.width / 2), 255)]; [videoCell

Memory leak from looping SKVideoNode (only on actual device)

梦想与她 提交于 2019-12-06 15:01:07
问题 I have a memory leak that I cannot diagnose. I have tried multiple approaches to creating a seamlessly looped video - Besides AVPlayerLooper, all of the approaches I've encountered and tried involve creating an observer to watch AVPlayerItemDidPlayToEndTimeNotification and then either seeking to the beginning of the video (in the case of AVPlayer) or inserting the video to be looped into the video queue (in the case of AVQueuePlayer). Both seem to have similar performance, but both also have

Swift won't play audio from link - iOS

梦想与她 提交于 2019-12-06 13:47:33
I am using Subsonic so mp3 files are served to me via a webservice. When I test using files that have a .mp3 extension this code works. When I use it with the link I have below it does not. var player: AVPlayer! override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "http://192.168.1.74:4040/rest/download?u=admin&p=admin&v=1.12.0&c=myapp&id=114&format=mp3")! let playerItem = CachingPlayerItem(url: url) playerItem.delegate = self player = AVPlayer(playerItem: playerItem) player.automaticallyWaitsToMinimizeStalling = false player.play() } } Browsing the link in 'url' provides me

Jumpy UISlider when scrubbing - Using UISlider with AVPlayer

假装没事ソ 提交于 2019-12-06 13:03:17
I am using AvPlayer and am trying to set up a slider to allow scrubbing of audio files. Im having a problem with the slider jumping all over the place when its selected. It then goes back to the origin position for a second before going back to the location it was dragged to. You cant see my cursor on the Gif, but the smooth elongated drags are me moving the knob, then the quick whips are the slider misbehaving. Ive spent hours googling and combing through Stack Overflow and cant figure out what I'm doing wrong here, a lot of similar questions are quite old and in ObjC. This is the section of

Why is AVPlayer not continuing to next song while in background?

一笑奈何 提交于 2019-12-06 12:43:40
问题 I have been streaming music from remote source using AVPlayer. I get URLs, use one to create an AVPlayerItem, which i then associate with my instance of AVPlayer. I add an observer to the item that I associate with the player to observe when the item finishes playing ( AVPlayerItemDidPlayToEndTimeNotification ). When the observer notifies me at the item end, I then create a new AVPlayerItem and do it all over again. This works well in the foreground AND in the background on iOS 9.2. Problem:

How to achieve a playback rate of 4.0 with AVPlayer in iOS?

廉价感情. 提交于 2019-12-06 11:57:38
player.rate = 4.0 doesn't work for me. Is it a good way to achieve rate of 4.0 with AVPlayer , or there is a better approach? user3480295 Use [AVComposition scaleTimeRange:toDuration:] to produce a fast-motion AVAsset . float rate = 4.0; AVAsset *asset = [AVAsset assetWithURL:someURL]; AVMutableComposition *composition = [AVMutableComposition composition]; NSError *error = nil; [composition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration) ofAsset:asset atTime:kCMTimeZero error:&error]; [composition scaleTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration) toDuration

AVPlayer play SKVideoNode video ,I just can not control the playback

南笙酒味 提交于 2019-12-06 11:43:38
I am using the SpriteKit to play video,this is my code to create the SKVideoNode from AVPlayer: func CreateVideoViewWithAVPlayer(player:AVPlayer) { video = SKVideoNode(AVPlayer: player) let frameLayer=AVPlayerLayer(player: player) //video?. = CGRectMake(0, 0, 100, 100) video?.size = CGSize(width: 1024, height: 768) println(player.currentItem) video?.anchorPoint = CGPoint(x: 0, y: 0) video?.position = CGPoint(x: 0, y: 0) backgroundColor = SKColor.blackColor() self.addChild(video!) } And I create a AVPlayer give the function: let scene01 = GameScene(size: view.bounds.size) scene01

AVPlayer Not Loading Media In Background

不打扰是莪最后的温柔 提交于 2019-12-06 11:35:35
When running in the background, my implementation of the AVPlayer is unable to play audio (e.g. podcast) that is downloaded, but is able to play songs that are stored locally. Failure to play in the background is only when the phone is disconnected from my computer. If my phone is direct connected to my computer/debugger, any media that is local or is downloaded plays without a problem. In the foreground, there is also no problem playing either media type. Here is my implementation: AVPlayer *moviePlayer; AVPlayerItem *playerItem; NSURL *address = /* the url of either a local song or remote