Swiftpack.co - FvnctionHQ/ts-player as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by FvnctionHQ.
FvnctionHQ/ts-player v0.1
A wrapper on AVAudioPlayer with progress callback and ability to play a segment from audio file
⭐️ 2
🕓 2 years ago
iOS
.package(url: "https://github.com/FvnctionHQ/ts-player.git", from: "v0.1")

TSPlayer [Please use AudioKit AudioPlayer instead]

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.

Installation

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

Api

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 }

Delegate

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

GitHub

link
Stars: 2
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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