-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlayerCommands.kt
70 lines (60 loc) · 1.67 KB
/
PlayerCommands.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
/*
* Copyright (c) SRG SSR. All rights reserved.
* License information is available from the LICENSE file.
*/
package ch.srgssr.pillarbox.player.extension
import androidx.media3.common.Player
/**
* Can seek to a later position in the current or next MediaItem.
*/
fun Player.Commands.canSeekToNext(): Boolean {
return contains(Player.COMMAND_SEEK_TO_NEXT)
}
/**
* Can seek to an earlier position in the current or previous MediaItem.
*/
fun Player.Commands.canSeekToPrevious(): Boolean {
return contains(Player.COMMAND_SEEK_TO_PREVIOUS)
}
/**
* Can seek back by a fixed increment into the current MediaItem.
*/
fun Player.Commands.canSeekForward(): Boolean {
return contains(Player.COMMAND_SEEK_FORWARD)
}
/**
* Can seek back by a fixed increment into the current MediaItem.
*/
fun Player.Commands.canSeekBack(): Boolean {
return contains(Player.COMMAND_SEEK_BACK)
}
/**
* Can seek anywhere into the current MediaItem.
*/
fun Player.Commands.canSeek(): Boolean {
return contains(Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM)
}
/**
* Can start, pause or resume playback.
*/
fun Player.Commands.canPlayPause(): Boolean {
return contains(Player.COMMAND_PLAY_PAUSE)
}
/**
* Can get details of the current track selection.
*/
fun Player.Commands.canGetTracks(): Boolean {
return contains(Player.COMMAND_GET_TRACKS)
}
/**
* set the player's track selection parameters.
*/
fun Player.Commands.canSetTrackSelectionParameters(): Boolean {
return contains(Player.COMMAND_SET_TRACK_SELECTION_PARAMETERS)
}
/**
* Can set the playback speed and pitch.
*/
fun Player.Commands.canSpeedAndPitch(): Boolean {
return contains(Player.COMMAND_SET_SPEED_AND_PITCH)
}