-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlayerTracks.kt
78 lines (72 loc) · 2.13 KB
/
PlayerTracks.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
/*
* Copyright (c) SRG SSR. All rights reserved.
* License information is available from the LICENSE file.
*/
package ch.srgssr.pillarbox.player.extension
import android.content.Context
import androidx.media3.common.Player
import androidx.media3.common.TrackSelectionOverride
/**
* Disable text track.
*/
@Deprecated(
message = "Use the `disableTextTrack()` extension from the `tracks` package instead",
replaceWith = ReplaceWith(
expression = "disableTextTrack()",
imports = ["ch.srgssr.pillarbox.player.tracks.disableTextTrack"],
),
)
fun Player.disableTextTrack() {
trackSelectionParameters = trackSelectionParameters.disableTextTrack()
}
/**
* Set default text track.
*
* @param context
*/
@Deprecated(
message = "Use the `setAutoTextTrack(Context)` extension instead",
replaceWith = ReplaceWith(
expression = "setAutoTextTrack(context)",
imports = ["ch.srgssr.pillarbox.player.tracks.setAutoTextTrack"],
),
)
fun Player.setDefaultTextTrack(context: Context) {
trackSelectionParameters = trackSelectionParameters.defaultTextTrack(context)
}
/**
* Disable audio track.
*/
@Deprecated(
message = "Use the `disableAudioTrack()` extension from the `tracks` package instead",
replaceWith = ReplaceWith(
expression = "disableAudioTrack()",
imports = ["ch.srgssr.pillarbox.player.tracks.disableAudioTrack"],
),
)
fun Player.disableAudioTrack() {
trackSelectionParameters = trackSelectionParameters.disableAudioTrack()
}
/**
* Set default audio track.
*
* @param context
*/
@Deprecated(
message = "Use the `setAutoAudioTrack(Context)` extension instead",
replaceWith = ReplaceWith(
expression = "setAutoAudioTrack(context)",
imports = ["ch.srgssr.pillarbox.player.tracks.setAutoAudioTrack"],
),
)
fun Player.setDefaultAudioTrack(context: Context) {
trackSelectionParameters = trackSelectionParameters.defaultAudioTrack(context)
}
/**
* Set track override.
*
* @param override
*/
fun Player.setTrackOverride(override: TrackSelectionOverride) {
trackSelectionParameters = trackSelectionParameters.setTrackOverride(override)
}