Accessing URL from AVPlayer object?

An AVPlayer plays an AVPlayerItem. AVPlayerItems are backed by objects of the class AVAsset. When you use the playerWithURL: method of AVPlayer it automatically creates the AVPlayerItem backed by an asset that is a subclass of AVAsset named AVURLAsset. AVURLAsset has a URL property. So, yes, in the case you provided you can get the … Read more

AVPlayer “freezes” the app at the start of buffering an audio stream

Don’t use playerItemWithURL it’s sync. When you receive the response with the url try this: AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil]; NSArray *keys = @[@”playable”]; [asset loadValuesAsynchronouslyForKeys:keys completionHandler:^() { [self.player insertItem:[AVPlayerItem playerItemWithAsset:asset] afterItem:nil]; }];

AVPlayer and MPMoviePlayerController differences [closed]

NOTE as of iOS9, Apple has deprecated the MPMoviePlayerController: The MPMoviePlayerController class is formally deprecated in iOS 9. (The MPMoviePlayerViewController class is also formally deprecated.) To play video content in iOS 9 and later, instead use the AVPictureInPictureController or AVPlayerViewController class from the AVKit framework, or the WKWebView class from WebKit. Copied from the MPMoviePlayerController … Read more

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

You can access currently played item by using currentItem property: AVPlayerItem *currentItem = yourAVPlayer.currentItem; Then you can easily get the requested time values CMTime duration = currentItem.duration; //total time CMTime currentTime = currentItem.currentTime; //playing time Swift 5: if let currentItem = player.currentItem { let duration = CMTimeGetSeconds(currentItem.duration) let currentTime = CMTimeGetSeconds(currentItem.currentTime()) print(“Duration: \(duration) s”) print(“Current … Read more

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

Yes, the AVPlayer class does not have a delegate protocol like the AVAudioPlayer. You need to subscribe to notifications on an AVPlayerItem. You can create an AVPlayerItem using the same URL that you would otherwise pass to -initWithURL: on AVPlayer. -(void)startPlaybackForItemWithURL:(NSURL*)url { // First create an AVPlayerItem AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:url]; // Subscribe to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)