Tag: avplayer

AVQueuePlayer playing several audio tracks in background iOS5

I used AVQueuePlayer to play several items in background. And code worked perfect in iOS4. And in iOS5 AVQueuePlayer changed its behavior, so player stops playing after first item is ended. Matt Gallagher wrote a hint in this post. “As of iOS 5, it appears that AVQueuePlayer no longer pre-buffers. It did pre-buffer the next […]

Custom button not working in AVPlayer iOS 11 but it's perfectly working below iOS 11?

I know possibly this is duplicate question but the question which is already exist didn’t have an solution so , I’m asking again to possibly start bounty question . Here is my code which is working below iOS 11 : AVPlayer *player = [AVPlayer playerWithURL:videoURL]; // create a player view controller avcontroller = [[AVPlayerViewController alloc]init]; […]

How to start next a Song or recognized that a song is finished while playing with AVPlayer?

How can I start next song immediately with AVPlayer? I have collections of song selected from iPod Library in MPMediaItemCollection. Now how can i use AVPlayer for lists of songs to be played one by one??

How to get thumbnail image of video from ALAsset in iOS?

I want to get thumbnail images of every frame from video and then save this images in Mutable Array of images. I want to use this images to play as a animation. NSURL* assetURL = [self.asset valueForProperty:ALAssetPropertyAssetURL]; NSDictionary* assetOptions = nil; AVAsset* myAsset = [[AVURLAsset alloc] initWithURL:assetURL options:assetOptions]; self.imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:myAsset]; int duration = […]

How to get video frame of the AVPlayer?

I have PlayerView class for displaying AVPlayer’s playback. Code from documentation. #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface PlayerView : UIView @property (nonatomic) AVPlayer *player; @end @implementation PlayerView + (Class)layerClass { return [AVPlayerLayer class]; } – (AVPlayer*)player { return [(AVPlayerLayer *)[self layer] player]; } – (void)setPlayer:(AVPlayer *)player { [(AVPlayerLayer *)[self layer] setPlayer:player]; } @end I set up […]

AVPlayer replaceCurrentItemWithPlayerItem not working on iOS 4.3.3+

I have an audio player that I’m building using AVPlayer. Currently, I keep the player instance around and when I need to swap tracks (either from a manual selection or the track has reached the end) I create a new AVPlayerItem and I call replaceCurrentItemWithPlayerItem with the new item. According to the docs, replaceCurrentItemWithPlayerItem is […]

Play encrypted video with AVPlayer

I’m implementing an application that contains video player. For some reasons video files are encrypted with AES, and size of these files can be rather big to avoid loading it to RAM as one piece. I’m looking for some way to play it with AVPlayer. Tried: 1) Custom NSURLProtocol as suggested here http://aptogo.co.uk/2010/07/protecting-resources/ Didn’t work, […]

AVPlayer Dynamic Volume control

How can I change the volume of the AVPlayer Dynamically? I mean, I want to mute the volume every time a button is pressed. the given code seems to change it in compile time only. How to do it during runtime??? AVURLAsset *asset = [AVURLAsset URLAssetWithURL:[self myAssetURL] options:nil]; NSArray *audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio]; NSMutableArray *allAudioParams […]

AVPlayer not playing from music library

I am trying to play a song from my iPhone music library using AVPlayer. Everything seems ready to play, but the player simply won’t make any sound. I’ve been struggling with this for a while, any help would be greatly appreciated! Note: I realize I could use AVAudioPlayer, but I would like to read the […]

AVPlayer not playing audio – iOS 9, Objective – C

I am trying to play audio from a URL in my app. Everything happens as expected in iOS 8 (simulator and physical devices). For iOS 9, it works in simulator but on device, the audio simply does not play. The streaming appears, if I click on play, the progress bar also shows that audio is […]