Skip to content

Instantly share code, notes, and snippets.

@xjbeta
Last active March 3, 2019 03:55
Show Gist options
  • Save xjbeta/cbe0d9704e60f3ed599da95e6d262f4d to your computer and use it in GitHub Desktop.
Save xjbeta/cbe0d9704e60f3ed599da95e6d262f4d to your computer and use it in GitHub Desktop.
IINA 'iina://' example.
import Cocoa
var urlQueryValueAllowed: CharacterSet = {
let generalDelimitersToEncode = ":#[]@?/" // does not include "?" or "/" due to RFC 3986 - Section 3.4
let subDelimitersToEncode = "!$&'()*+,;="
var allowed = CharacterSet.urlQueryAllowed
allowed.remove(charactersIn: generalDelimitersToEncode + subDelimitersToEncode)
return allowed
}()
let videoUrl = "/test/test.webm".addingPercentEncoding(withAllowedCharacters: urlQueryValueAllowed)!
let audioUrl = "/test/test.m4a".addingPercentEncoding(withAllowedCharacters: urlQueryValueAllowed)!
let iinaUrl = "iina://open?url=\(videoUrl)&mpv_audio-file=\(audioUrl)"
print(iinaUrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment