0

I've tried https://github.com/ap4y/OrigamiEngine but I can't get it to play flac files.

here's a sample

var url = "/Users/Simun/Downloads/track.flac"
url = url.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())!
let trackUrl = NSURL(string:"file://localhost/\(url)")
player.playUrl(trackUrl)
greg-449
  • 109,219
  • 232
  • 102
  • 145
Struki84
  • 175
  • 1
  • 1
  • 12

2 Answers2

0

I am not aware of other libraries for playing FLAC in Swift, but https://github.com/ap4y/OrigamiEngine does do the job. The most difficult part for me was simply getting this Objective-C library included in a Swift XCode project using cocoapods (importing the headers and linking). Once that is accomplished, the following code should play a file:

let origami = ORGMEngine()
origami.play(URL(fileURLWithPath: "/Users/user/xyz.flac"))
abyrd
  • 611
  • 6
  • 8
  • 1
    Hi there!, Can you explain how did you manage to do it? I didn't want to use cocoapods so I exported the .a with its headers. I managed to play mp3 but flac isn't working :( Thanks! – Mijail Mar 16 '17 at 11:32
0

I have succeeded to preview .flac files using two native things:

  • AVKit's AVPlayerViewController
  • QuickLook
stackich
  • 3,607
  • 3
  • 17
  • 41