-
Notifications
You must be signed in to change notification settings - Fork 1
/
PillarboxPlayer.kt
79 lines (71 loc) · 2.49 KB
/
PillarboxPlayer.kt
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright (c) SRG SSR. All rights reserved.
* License information is available from the LICENSE file.
*/
package ch.srgssr.pillarbox.player
import androidx.media3.common.Player
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.SeekParameters
import ch.srgssr.pillarbox.player.asset.timeRange.BlockedTimeRange
import ch.srgssr.pillarbox.player.asset.timeRange.Chapter
import ch.srgssr.pillarbox.player.asset.timeRange.Credit
/**
* Pillarbox [Player] interface extension.
*/
interface PillarboxPlayer : Player {
/**
* Listener
*/
interface Listener : Player.Listener {
/**
* On smooth seeking enabled changed
*
* @param smoothSeekingEnabled The new value of [PillarboxPlayer.smoothSeekingEnabled]
*/
fun onSmoothSeekingEnabledChanged(smoothSeekingEnabled: Boolean) {}
/**
* On tracking enabled changed
*
* @param trackingEnabled The new value of [PillarboxPlayer.trackingEnabled]
*/
fun onTrackingEnabledChanged(trackingEnabled: Boolean) {}
/**
* `onChapterChanged` is called when either:
* - The player position changes while playing automatically.
* - The use seeks to a new position.
* - The playlist changes.
*
* @param chapter `null` when the current position is not in a chapter.
*/
fun onChapterChanged(chapter: Chapter?) {}
/**
* On blocked time range reached
*
* @param blockedTimeRange The [BlockedTimeRange] reached by the player.
*/
fun onBlockedTimeRangeReached(blockedTimeRange: BlockedTimeRange) {}
/**
* `onCreditChanged` is called when either:
* - The player position changes while playing automatically.
* - The use seeks to a new position.
* - The playlist changes.
*
* @param credit `null` when the current position is not in a Credit.
*/
fun onCreditChanged(credit: Credit?) {}
}
/**
* Smooth seeking enabled
*
* When [smoothSeekingEnabled] is true, next seek events is send only after the current is done.
*
* To have the best result it is important to
* 1) Pause the player while seeking.
* 2) Set the [ExoPlayer.setSeekParameters] to [SeekParameters.CLOSEST_SYNC].
*/
var smoothSeekingEnabled: Boolean
/**
* Enable or disable MediaItem tracking
*/
var trackingEnabled: Boolean
}