INNER CODE UNIT · Swift

getUrlByType

florent37/Flutter-AssetsAudioPlayer · darwin/Classes/Music.swift:127

    func getUrlByType(path: String, audioType: String, assetPackage: String?) -> URL? {
        var url : URL
        
        if(audioType == "network" || audioType == "liveStream"){
            if let u = URL(string: path) {
                return u
            } else {
                print("Couldn't parse myURL = \(path)")
                return nil
            }
            
        } else if(audioType == "file"){
            var localPath = path
            //if(localPath.starts(with: "/")){ //if alreeady starts with "file://", do not add
            //    localPath = "file:/" + localPath
            //}
            if(!localPath.starts(with: "file://")){ //if already starts with "file://", do not add
                localPath = "file://" + localPath

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…