Questions tagged [avurlasset]

This tag should be used for questions about the AVURLAsset class of the AVFoundation framework used in iOS, macOS, and tvOS.

AVURLAsset is a concrete subclass of AVAsset that you use to initialize an asset from an URL.

Complete Class Reference in apple.

112 questions
5
votes
2 answers

I cannot get a precise CMTime for Generating Still Image from 1.8 second Video

Every time I try to generate a still frame from my video asset, it is generated at a time of 0.000.. seconds. I can see this from my log message. The good thing is that I can get the image at time 0.000.. to show up in a UIImageView called…
johntraver
  • 3,612
  • 18
  • 17
5
votes
0 answers

Read HLS Playlist information to dynamically change the preferredBitRate of an Item

I'm working on a video app, we are changing form regular mp4 files to HLS, one of the many reasons we have to do the change is that we hace much more control over the bandwidth usage of videos (we load lots of other stuff in our player, so we need…
Fantini
  • 2,067
  • 21
  • 32
5
votes
0 answers

AVURLAsset / AVPlayerItem from Asset Catalog

I have a bunch of audio files which I keep in my asset catalog to benefit from the store optimizations that it brings. However, the AVAudioPlayer ideally wants AVURLAssets from which subsequently AVPlayerItems can be created. Problem is, asset data…
hoshy
  • 481
  • 6
  • 15
5
votes
2 answers

How to handle large files with NSData?

I have a very large video and I need to chunk this video to upload it to Dropbox. I tried to use NSData, but because this file is too large, my application always crashes, so I don't know what I can do now. For smaller videos, I used…
testa abalez
  • 1,042
  • 3
  • 13
  • 28
5
votes
3 answers

How to cache audio to local when playing audio with avplayer

I play an audio online with AVPlayer,and want to save the data/stream of audio to local when avplayer finish loading stream. I implementt it as the following: let fileUrl = NSURL(string: strUrl)! let asset = AVURLAsset(URL: fileUrl) …
Leo
  • 835
  • 1
  • 12
  • 31
5
votes
1 answer

Getting the AVURLAsset of a local audio file

i'm currently writing an iOS app that works with audio files, and one part of the app is to create the waveform of an audio file. Therefore i need an AVURLAsset object so that the AVAssetReader can get the data of the audio file. No problem there…
chritaso
  • 613
  • 7
  • 23
5
votes
2 answers

naturalSize returning wrong orientation from AVURLAsset

Im using the code found [here][1] to attach image on video taken using UIImagePickerController. the video is in portrait and playing fine but once I use AVURLASSet it turning landscape orientation instead of portrait and I cant find why? Can any one…
user513790
  • 1,225
  • 1
  • 13
  • 22
4
votes
1 answer

AVAssetResourceLoaderDelegate: redirect manifest request?

Is it possible to redirect a manifest request in shouldWaitForLoadingOfRequestedResource to a different url? I need to process some manifests manually (this part works good), while other redirect to different url. But if I'm trying to…
norlin
  • 1,205
  • 11
  • 24
4
votes
1 answer

AVURLAsset URLAssetWithURL:options: blocks main thread with remote URL?

I've found no documentation about this, but in my practical experience AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; (where url is a remote URL for an HLS live stream), will block the main thread if the network is down or for…
3
votes
0 answers

3gp video and AVPlayer in iPhone

I have an iPhone application that plays the videos of Camera Roll using AVPlayer. I have a 3gp video in my iPhone which I am not able to play using AVPlayer but can be played in Photos app. I would like to achieve these: The videos that are not…
spd
  • 2,114
  • 1
  • 29
  • 54
3
votes
1 answer

Merge two mpeg-2 transport stream files into one media file on iOS

Media file segmenter is a tool provided by Apple It can divides one media file into a series of small mpeg-2 transport stream files for HTTP Live Streaming Now, I would like to do a reverse job: merge all of the mpeg-2 transport stream files into…
bandw
  • 879
  • 2
  • 11
  • 30
3
votes
0 answers

Audio playing but video freezes AVPlayer on slow internet

I load my AVAsset asynchronously through this method: playerAsset.loadValuesAsynchronously(forKeys: ["duration", "playable", "hasProtectedContent"]) { DispatchQueue.main.async {[weak self] in guard let strongSelf = self else { return } …
3
votes
3 answers

How do I update the metadata of an AVURLAsset after downloading via AVAssetDownloadTask/Session?

I am implementing offline playback of some HLS/m3u8 streams. Everything is working as intended using AVAssetDownloadURLSession, using it to make AVAssetDownloadTasks given an AVURLAsset from a stream url. I would like to save some custom information…
JAB
  • 3,165
  • 16
  • 29
3
votes
0 answers

AVURLAsset (MP3) showing no audio tracks

I am trying to set an mp3 as the audio track of a video. However, I am finding no tracks in the AVURLAsset. This mp3 is in my project so it is a local file. My code is below, I have also tried to get any tracks but that comes back out of range as…
berr08
  • 236
  • 1
  • 16
3
votes
1 answer

Why can't I extract data from media file using AVURLAsset in a Playground?

In my Playground: import Cocoa import Foundation import AVFoundation var path2 = "/Users/me/Movies/bukesiyi.mp4" var video2 = NSURL(fileURLWithPath: path2, isDirectory: false) // it shows:…
haofly
  • 829
  • 12
  • 15