Skip to content

Instantly share code, notes, and snippets.

@netgfx
Last active February 23, 2018 21:23
Show Gist options
  • Select an option

  • Save netgfx/f88e21c859cb61ffa96c25f15fac0bc8 to your computer and use it in GitHub Desktop.

Select an option

Save netgfx/f88e21c859cb61ffa96c25f15fac0bc8 to your computer and use it in GitHub Desktop.
import AVFoundation
let fileURL = NSURL(string: "https://freemusicarchive.org/file/music/ccCommunity/Rotten_Bliss/The_Nightwatchman_Sings/Rotten_Bliss_-_08_-_Timer_Erase.mp3")
let avAsset = AVAsset(url: fileURL! as URL)
let assetKeys = ["playable"]
var playerItem = AVPlayerItem(asset: avAsset, automaticallyLoadedAssetKeys: assetKeys)
var playerQueue = AVQueuePlayer(items: [playerItem])
playerQueue.play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment