-
Notifications
You must be signed in to change notification settings - Fork 49
/
AudioPlayerDelegate.swift
34 lines (27 loc) · 1.64 KB
/
AudioPlayerDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Created by Dimitrios Chatzieleftheriou on 03/08/2020.
// Copyright © 2020 Decimal. All rights reserved.
//
import Foundation
public protocol AudioPlayerDelegate: AnyObject {
/// Tells the delegate that the player started player
func audioPlayerDidStartPlaying(player: AudioPlayer, with entryId: AudioEntryId)
/// Tells the delegate that the player finished buffering for an entry.
/// - note: May be called multiple times when seek is requested
func audioPlayerDidFinishBuffering(player: AudioPlayer, with entryId: AudioEntryId)
/// Tells the delegate that the state has changed passing both the new state and previous.
func audioPlayerStateChanged(player: AudioPlayer, with newState: AudioPlayerState, previous: AudioPlayerState)
/// Tells the delegate that an entry has finished
func audioPlayerDidFinishPlaying(player: AudioPlayer,
entryId: AudioEntryId,
stopReason: AudioPlayerStopReason,
progress: Double,
duration: Double)
/// Tells the delegate when an unexpected error occurred.
/// - note: Probably a good time to recreate the player when this occurs
func audioPlayerUnexpectedError(player: AudioPlayer, error: AudioPlayerError)
/// Tells the delegate when cancel occurs, usually due to a stop or play (new source)
func audioPlayerDidCancel(player: AudioPlayer, queuedItems: [AudioEntryId])
/// Tells the delegate when a metadata read occurred from the stream.
func audioPlayerDidReadMetadata(player: AudioPlayer, metadata: [String: String])
}