Questions tagged [avplayeritem]
277 questions
8
votes
1 answer
Is there any difference between using AVPlayer, AVPlayerItem, and AVPlayerAsset?
I found the three ways to play video with URL.
let url = "some url"
// first way
AVPlayer(url: url)
// second way
let playerItem = AVPlayerItem(url: url)
AVPlayer(playerItem: playerItem)
// third way
let asset = AVAsset(url: url)
let playerItem =…

user12208004
- 1,704
- 3
- 15
- 37
8
votes
1 answer
How to get thumbnail image from .m3u8 formate video url in Swift?
func getThumbnailFrom(path: URL?, withCompletionHandler completion:@escaping ((UIImage)-> Void)){
var thumbnail = UIImage(named: "name of Dummy Image")
if let url = path{
DispatchQueue.global(qos: .background).async {
…

Zalak Parikh
- 450
- 4
- 11
8
votes
3 answers
How to close previous AVPlayer and AVPlayerItem
I'm making an iOS app in Swift that plays a video in a loop in a small layer in the top right corner of the screen which shows a video of specific coloured item. the user then taps the corresponding coloured item on the screen. when they do, the…

TuxedoedCastle
- 161
- 1
- 1
- 9
8
votes
1 answer
AVPlayer does not fire playbackBufferEmpty but does not play either
I use AVPlayer to play an audio livestream via internet. I like to recover playback if it was paused for longer than 1 minute.
I call player.rate = 1.0 to resume. However if the stream was paused for >1 minute it does not play any more. I need to…

funkenstrahlen
- 3,032
- 2
- 28
- 40
8
votes
3 answers
AVPlayer throwing : "Internal error: restarting too far ahead"
I am observing KVO AVPlayerItemNewErrorLogEntryNotification of the AVPlayer and I find the following error:
errorStatusCode:-12645 errorDomain :CoreMediaErrorDomain
errorComment:Internal error: restarting too far ahead (-1.4084s)
I am unable…

karthik
- 1,271
- 1
- 14
- 27
8
votes
0 answers
AVPlayerItem status AVPlayerStatusFailed when playing video
I implemented Video Playback for multiple videos with AVPlayer. When I play next video, sometimes it shows this error messages:
Error Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped"
UserInfo=0x1744796c0…

Thuc Pham
- 153
- 1
- 11
8
votes
1 answer
How to play Apple Music files (even "available offline" ones) with AVPlayer?
Is it possible to play Apple Music files—even the "available offline" ones—with AVPlayer? I've tried the following code to retrieve the URL, but it returns nil:
- (void)mediaPicker:(MPMediaPickerController *)mediaPicker…

Rogare
- 3,234
- 3
- 27
- 50
7
votes
3 answers
How to convert Data to AVAsset?
Is there a way to convert Data to AVAsset/AVURLAsset or better AVPlayerItem?
I found an answer that converts Data to PHAsset and requires saving it first to the desk.
Is there a better way?

Elsammak
- 1,102
- 10
- 26
7
votes
1 answer
Swift iOS -How to Access Error from AVPlayerItemStatus?
I'm using an AVPlayer to play a video url. I followed Apple's code to play the video and handle errors:
Inside the section that says Respond to A State Change there is a switch statement that has a .failed case and the commented out code says: //…

Lance Samaria
- 17,576
- 18
- 108
- 256
7
votes
1 answer
Remove Quicktime logo from AVPlayerViewController
I was implementing a video player using AVPlayerViewController. it showing quick time logo on iOS 11 devices while streaming the video.
How to remove this? I need to use a custom image as placeholder.
plase find my code :
AVPlayerItem *playerItem =…

Vinu David Jose
- 2,569
- 1
- 21
- 38
7
votes
2 answers
set AVPlayer AVPlayerItem buffer size?
Playing video with avplayer, listening to the loadedTimeRanges property, playing about 10 minutes of video, avplayer always preload the video, and feel very costly, is there a way to limit the size of the preloaded area? Such as pre-loading video…

xywwjf
- 81
- 1
- 2
7
votes
3 answers
How to change Video PlayBack Quality with AVPlayer?
How can I change Video Quality like YouTube?
Currently, I am playing with original quality and I am giving options like 360p, 480p, 720p for changing quality.
How can I change it?

Kuldeep
- 4,466
- 8
- 32
- 59
7
votes
6 answers
iOS 10 - AVPlayer shows black screen when playing video
Here I have a method that adds the video layer to the UIView that I have setup in IB:
-(void)loadPlayer{
self.asset = [AVAsset assetWithURL:url];
AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:self.asset];
…

badhanganesh
- 3,427
- 3
- 18
- 39
7
votes
0 answers
AVPlayer's video and audio become out of sync after pausing and then resuming video
I'm using AVPlayer to play videos in my app. Video playback always works perfectly, except for when you pause/resume the video. If the user presses the pause button, and then resumes the video, sometimes the audio will be ahead of the video.
The…

user3344977
- 3,584
- 4
- 32
- 88
7
votes
1 answer
avplayeritem always at unknown status
I just found a very strange problem,
when loading a mp3 file from local storage,
avplayeritem always at unknown status and can not been played if the file placed in document folder.
way 1:
//AVAsset *asset = [[AVURLAsset alloc] initWithURL:_URL…

user2919667
- 83
- 1
- 4