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
221
votes
7 answers

capturing self strongly in this block is likely to lead to a retain cycle

How can I avoid this warning in xcode. Here is the code snippet: [player(AVPlayer object) addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(0.1, 100) queue:nil usingBlock:^(CMTime time) { current+=1; if(current==60) { …
168
votes
9 answers

How to play a local video with Swift?

I have a short mp4 video file that I've added to my current Xcode6 Beta project. I want to play the video in my app. After hours searching, I can't find anything remotely helpful. Is there a way to accomplish this with Swift or do you have to use…
36 By Design
  • 3,203
  • 3
  • 18
  • 18
152
votes
22 answers

Looping a video with AVFoundation AVPlayer?

Is there a relatively easy way of looping a video in AVFoundation? I've created my AVPlayer and AVPlayerLayer like so: avPlayer = [[AVPlayer playerWithURL:videoUrl] retain]; avPlayerLayer = [[AVPlayerLayer playerLayerWithPlayer:avPlayer]…
orj
  • 13,234
  • 14
  • 63
  • 73
131
votes
6 answers

How to reduce iOS AVPlayer start delay

Note, for the below question: All assets are local on the device -- no network streaming is taking place. The videos contain audio tracks. I'm working on an iOS application that requires playing video files with minimum delay to start the video…
Bernie Habermeier
  • 2,580
  • 2
  • 22
  • 20
120
votes
12 answers

Check play state of AVPlayer

Is there a way to know whether an AVPlayer playback has stalled or reached the end?
Egil
  • 4,265
  • 4
  • 20
  • 13
103
votes
17 answers

How to detect when AVPlayer video ends playing?

I'am using AVPlayer for playing local video file (mp4) in Swift. Does anyone know how to detect when video finish with playing? Thanks
Nik
  • 1,517
  • 5
  • 14
  • 19
90
votes
5 answers

No AVPlayer Delegate? How to track when song finished playing? Objective C iPhone development

I've looked around but I can't find a delegate protocol for the AVPlayer class. What gives? I'm using its subclass, AVQueuePlayer, to play an array of AVPlayerItems, each loaded from a URL. Is there any way I can call a method when a song finishes…
Tyler
  • 911
  • 1
  • 6
  • 3
89
votes
10 answers

How do I get current playing time and total play time in AVPlayer?

Is it possible get playing time and total play time in AVPlayer? If yes, how can I do this?
Voloda2
  • 12,359
  • 18
  • 80
  • 130
89
votes
10 answers

Knowing when AVPlayer object is ready to play

I'm trying to play an MP3 file that is passed to an UIView from a previous UIView (stored in a NSURL *fileURL variable). I'm initializing an AVPlayer with: player = [AVPlayer playerWithURL:fileURL]; NSLog(@"Player created:%d",player.status); The…
mvishnu
  • 1,150
  • 1
  • 12
  • 15
87
votes
1 answer

AVPlayer and MPMoviePlayerController differences

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?
suse
  • 10,503
  • 23
  • 79
  • 113
73
votes
6 answers

Maintaining good scroll performance when using AVPlayer

I'm working on an application where there is a collection view, and cells of the collection view can contain video. Right now I'm displaying the video using AVPlayer and AVPlayerLayer. Unfortunately, the scrolling performance is terrible. It seems…
Antonio
  • 988
  • 1
  • 7
  • 12
65
votes
2 answers

AVPlayer HLS live stream level meter (Display FFT Data)

I'm using AVPlayer for a radio app using HTTP live streaming. Now I want to implement a level meter for that audio stream. The very best would a level meter showing the different frequencies, but a simple left / right solution would be a great…
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
62
votes
3 answers

AVPlayer "freezes" the app at the start of buffering an audio stream

I am using a subclass of AVQueuePlayer and when I add new AVPlayerItem with a streaming URL the app freezes for about a second or two. By freezing I mean that it doesn't respond to touches on the UI. Also, if I have a song playing already and then…
raixer
  • 1,844
  • 3
  • 15
  • 16
62
votes
13 answers

AVPlayer layer inside a view does not resize when UIView frame changes

I have a UIView which contains an AVPlayer to show a video. When changing orientation, I need to change the size and location of the video. I'm not very experienced with resizing layers, so I'm having problems making the video resize. I start by…
theDuncs
  • 4,649
  • 4
  • 39
  • 63
58
votes
2 answers

Getting PCM data of HLS from AVPlayer

This question seems to be asked few times over last few years but none has answer for that. I am trying to process PCM data from HLS and I have to use AVPlayer. this post taps the local…
Mord Fustang
  • 1,523
  • 4
  • 40
  • 71
1
2 3
99 100