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
37
votes
5 answers

AVPlayer seekToTime does not play at correct position

I have an AVPlayer which is playing a HLS video stream. My user interface provides a row of buttons, one for each "chapter" in the video (the buttons are labeled "1", "2", "3"). The app downloads some meta-data from a server which contains the list…
Jordan Bigel
  • 605
  • 1
  • 8
  • 10
36
votes
5 answers

AVPlayerItem fails with AVStatusFailed and error code "Cannot Decode"

I'm running into a strange issue, I hope someone can help. In my iOS app I create a video with a custom soundtrack using MutableComposition by combining a video from the user's photo library and an audio file from the app bundle. I then use an…
user1112293
  • 381
  • 1
  • 3
  • 4
35
votes
4 answers

Is it possible to cache HLS segments with AVPlayer?

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…
35
votes
5 answers

Hide controls in AVPlayerViewController -- only at start

If you set AVPlayerViewController.showsPlaybackControls to false, the controls will not show at all. Even if you tap the screen. I want the controls to start out hidden, but still be able to summon them by tapping. If I set the mentioned property to…
Andrew Duncan
  • 3,553
  • 4
  • 28
  • 55
35
votes
8 answers

How to track when song finished playing using AVPlayer in Swift

What is the east way to track when song finishes playing with AVPlayer in Swift? Is there any function which is called when AVPlayer finishes playing, or I should combine timer with AVPlayer class references?
Mega4alik
  • 597
  • 3
  • 10
  • 18
34
votes
7 answers

How do I get my AVPlayer to play while app is in background?

I've done my homework... been reading here, the docs, googling, stackoverflowing... but still no luck in making my sound stick when the user makes the app go into the background. What I have done so far: Added the UIBackgroundModes, audio to the…
swe_mattias
  • 621
  • 1
  • 8
  • 15
34
votes
5 answers

AVPlayer was deallocated while key value observers were still registered with it

I am creating a simple media player app. My App is crashed when first link is played and I clicked second link in uitableview. - (void)viewDidLoad { [super viewDidLoad]; arrURL = [NSArray arrayWithObjects:…
Mihir Oza
  • 2,768
  • 3
  • 35
  • 61
33
votes
1 answer

ARKit SKVideoNode Playing on Render

Main Problem: I am adding this section AFTER to clarify the problem. -- I can PAUSE my video (I do not want it playing on a loop). When my node comes into sight, my node plays my video, even if it is on pause. If my video has finished playing, and…
impression7vx
  • 1,728
  • 1
  • 20
  • 50
33
votes
5 answers

How to stop a video in AVPlayer?

I am using this code to play video file using avplayer how do I stop it [videoView setHidden:NO]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths…
iTag
  • 413
  • 1
  • 4
  • 10
33
votes
6 answers

Add custom header field in request of AVPlayer

Is it possible to send headers with an http request to an audio file when using AVPlayer? I need to be able to inspect the content of the header when received by the server in order to restrict access to the file being requested.
user732538
  • 333
  • 1
  • 3
  • 5
32
votes
6 answers

How to mute video played in AVPlayer?

Im playing a video in AVPlayer, and now I need to mute the audio alone while playing it. Please suggest how to do in objective C. Thanks, Suresh
Suresh
  • 321
  • 1
  • 3
  • 3
31
votes
8 answers

How to play movie files with no file extension on iOS with MPMoviePlayerController or AVPlayer?

I want to play a movie in iOS 4.3 on the iPad. I've successfully used MPMoviePlayerController and AVPlayer to load files from a remote URL when the filename has a file extension. However, when I use a CDN that doesn't return the filename (just an…
Michael
  • 1,355
  • 2
  • 12
  • 15
31
votes
11 answers

Calling function from another ViewController in swift

I have already looked in Stackoverflow but I can't get an answer. I want to create function that stop playing the sound in another ViewController. But when I clicked the stop button, it cracked and showed "EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP,…
Andyopf
  • 441
  • 1
  • 5
  • 12
31
votes
2 answers

MPNowPlayingInfoCenter Disappears when audio stream stalls

My app plays streaming audio via AVPlayer, and uses MPNowPlayingInfoCenter to display info about the stream on the device lock screen. This works fine when audio is actually playing, but if the stream stalls due to network slowdowns (i.e. I receive…
Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
31
votes
6 answers

AVplayer resuming after incoming call

I am using AVPlayer for music playback. My problem is that after an incoming call, the player won't resume. How do I handle this when an incoming call comes?
user2889249
  • 899
  • 2
  • 13
  • 22