Questions tagged [avplayer]

An AVPlayer object is used to implement controllers and user interfaces for single- or multiple-item playback.

An AVPlayer object is used to implement controllers and user interfaces for single- or multiple-item playback.

3602 questions
30
votes
8 answers

How to detect AVPlayer actually started to play in swift

Hello I have set my UISliderminimum value to 0.00. Then I set it's max value in this way. self.viewPlayer.layer.addSublayer(playerLayer) let duration : CMTime = avPlayer.avPlayer.currentItem!.asset.duration let seconds : Float64 =…
user1960169
  • 3,533
  • 12
  • 39
  • 61
30
votes
2 answers

AVPlayerItem replaceCurrentItemWithPlayerItem Blocking

First a little context about the application... - There's a lot of heavy UI operation's involving video players (mostly scrolling) - The videos are dynamic and change based on our current page . - so the video's have to be dynamic and keep…
Aatish Molasi
  • 2,138
  • 3
  • 20
  • 43
29
votes
9 answers

Timeline Progress bar for AVPlayer

AVPlayer is fully customizable, unfortunately there are convenient methods in AVPlayer for showing the time line progress bar. AVPlayer *player = [AVPlayer playerWithURL:URL]; AVPlayerLayer *playerLayer = [[AVPlayerLayer…
Sanjeev Rao
  • 2,247
  • 1
  • 19
  • 18
28
votes
4 answers

iOS 7 AVPlayer AVPlayerItem duration incorrect in iOS 7

I have the following code in my app: NSURL *url = [NSURL fileURLWithPath: [self.DocDir stringByAppendingPathComponent: self.FileName] isDirectory: NO]; self.avPlayer = [AVPlayer playerWithURL: url]; Float64 duration =…
Matt Wolfe
  • 8,924
  • 8
  • 60
  • 77
25
votes
4 answers

AVPlayer continues to play after ViewController is removed from NavigationController

So I'm using ARC in my project and when I add an AVPlayerLayer it works just fine and dandy, but when I pop the UIViewController from my UINavigationItem the video continues to play in the background. Does anyone know how you would handle this? It…
James Parker
  • 2,095
  • 3
  • 27
  • 48
24
votes
0 answers

Convert NSDate from AVDateRangeMetadataGroup to CMTime

AVPlayer primarily measures times with CMTime. However when using an AVPlayerItemMetadataCollector to collect date range metadata from an HLS stream, the resulting AVDateRangeMetadataGroups hold NSDates instead of CMTimes. My problem is I want to…
Lily Ballard
  • 182,031
  • 33
  • 381
  • 347
24
votes
5 answers

Turn off audio playback of AVPlayer?

I have a AVPlayer with AVPlayerItem. What i want is to turn off the audio playback off AVPlayer. I want play just video. Can someone help me? Thank you! self.avPlayerItem = [AVPlayerItem playerItemWithURL:self.videoUrl]; self.avPlayer =…
Gaby Fitcal
  • 1,814
  • 1
  • 17
  • 28
24
votes
6 answers

Stop AVPlayer and restart MP3 file again

I want to start, pause and stop (same as restart) my mp3 File and I'm using AVPlayer. I get the files from a server. To start the song I do: [self.player start]; To pause I do: [self.player pause]; but when I want to stop the song and reload it,…
Davis
  • 1,253
  • 4
  • 17
  • 38
24
votes
5 answers

iOS 7 SDK not abiding background audio

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…
codejunkie
  • 1,122
  • 3
  • 13
  • 29
23
votes
6 answers

Pre-buffering for AVQueuePlayer

Does anyone know if AVQueuePlayer starts buffering the next AVPlayerItem when the current item is about to finish playing? I know there's nothing in the docs to suggest this, I'm asking mostly if anyone has observed this kind of behavior or not.
Mihai Damian
  • 11,193
  • 11
  • 59
  • 81
22
votes
2 answers

AVPlayer too long and with delay to readyToPlay and play server music in swift

I tried to buffer and immediately play remote url audio with swift language. but problem is with long time to readyToPlay case and play. for example a sound url takes about 12 to 15 second to run. this is my code : var asset: AVAsset! var player:…
Saeid
  • 2,261
  • 4
  • 27
  • 59
22
votes
1 answer

Seek to a certain position in AVPlayer right after the asset was loaded

This works: I have an AVPlayer which plays a video right after it was loaded. And this works fine. This doesn't: Instead of starting the video at the beginning, I want to play it at a given position. So I wait until the asset is ready for Play using…
Besi
  • 22,579
  • 24
  • 131
  • 223
22
votes
3 answers

Playing an ogg stream in iOS

Has anyone played an ogg stream from iOS? What can I use without having to write my own decoder? I'm using Apple's AVPlayer to play the stream. This question has been asked as part of this thread: iOS online radio streaming questions but it hasn't…
nnyby
  • 4,748
  • 10
  • 49
  • 105
21
votes
7 answers

AVPlayer And Local Files

I am building a MP3 player for iOS that plays audio files hosted on the web. I want to offer the ability to play the files offline so I have the files downloading using ASIHTTP but I am cannot seem to find info on initiallzing AVPlayer with a mp3 in…
stitz
  • 1,429
  • 1
  • 16
  • 33
21
votes
5 answers

how to play a video in UIView swift?

I have a video which I want to download from a server and stream it in a fixed view. I've set a UIView in my storyboard with fixed constraints, and here is what I've done in code: @IBOutlet weak var videoView: UIView! var player: AVPlayer! var…
Azin Nilchi
  • 849
  • 1
  • 10
  • 24