8
Why does AVPlayer start playing this video 90% of the way through?
Post Body
Here's a random MP4 video of a car from Gfycat: https://thumbs.gfycat.com/IdolizedInformalKoalabear-mobile.mp4
When using with AVPlayer
it starts playing 90% of the way through. On the next play through it starts playing from the beginning properly. This is causing a weird edge case with my code and I'm wondering if there's a reason AVPlayer is behaving like this that I can curtail or work with properly? Is it metadata in the video file indicating to do this?
Here's really simple sample code you can copy-paste into any view controller to test:
guard let url = URL(string: "https://thumbs.gfycat.com/IdolizedInformalKoalabear-mobile.mp4") else { return }
let player = AVPlayer(url: url)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
present(playerViewController, animated: true) {
player.play()
}
(Make sure you import AVKit
)
Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,715,057
Link Karma
529,042
Comment Karma
607,499
Profile updated: 3 days ago
Posts updated: 5 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/iOSProgramm...