I have included an mp4 resource in my project navigator. I want to play it in an AVPlayer. I know how to create an AVPlayerItem for the AVPlayer object, and so now I'd like to load the appropriate AVAsset into it pointing to my mp4 resource. The problem is that AVAsset only has an assetWithURL: method to create an AVAsset. I want an assetWithName: method, but that method does not exist. How can I play my mp4 file if I don't have a URL for it? If it's not possible to play via name reference, how can I get a file URL for my mp4 file?
An object that models the timing and presentation state of an asset during playback.
To get the URL, use
[[NSBundle mainBundle] URLForResource:@"my_video" withExtension:@"mp4"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With