Swiftpack.co -  FvnctionHQ/ts-player as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A wrapper on AVAudioPlayer with progress callback and ability to play a segment from audio file
.package(url: "https://github.com/FvnctionHQ/ts-player.git", from: "v0.1")


A wrapper on AVAudioPlayer with progress callback and ability to play a segment from audio file. Uses several relevant AudioKit classes so you don't have to import AudioKit if you don't need it.


To add TSPlayer to your Xcode project, select File -> Swift Packages -> Add Package Depedancy. Enter https://github.com/FvnctionHQ/ts-player


After init load file or use convenience init
func load(file: AVAudioFile) throws

Play entire file
func play()

Play entire file from time
func play(from time: TimeInterval)

Play segment from the file
func play(from inTime: TimeInterval, till outTime: TimeInterval)

Pause playback
func pause()

Toggle loopining
func toggleLooping()

Check if player is playing
var isPlaying: Bool { get }

Check if player is in loop mode
var isLooping: Bool { get }


func playerPlaybackProgressDidUpdate(player: TSPlayer, progress: TimeInterval, isSegment: Bool)
Called as player plays the file, isSegment is true if currently played file is a segment of entire file defined by inTime and outTime

func playerDidFinish(player: TSPlayer)
Called when player finished playback in non-looping mode

func playerDidFail(player: TSPlayer, error: TSPlayerModuleError)
Called when player experienced an error


Stars: 0
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API