-
-
Notifications
You must be signed in to change notification settings - Fork 757
/
YouTubePlayer.kt
64 lines (51 loc) · 1.93 KB
/
YouTubePlayer.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
package com.pierfrancescosoffritti.androidyoutubeplayer.core.player
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.YouTubePlayerListener
/**
* Use this interface to control the playback of YouTube videos and to listen to their events.
*/
interface YouTubePlayer {
/**
* Loads and automatically plays the video.
* @param videoId id of the video
* @param startSeconds the time from which the video should start playing
*/
fun loadVideo(videoId: String, startSeconds: Float)
/**
* Loads the video's thumbnail and prepares the player to play the video. Does not automatically play the video.
* @param videoId id of the video
* @param startSeconds the time from which the video should start playing
*/
fun cueVideo(videoId: String, startSeconds: Float)
fun play()
fun pause()
/** If the player is playing a playlist, play the next video. */
fun nextVideo()
/** If the player is playing a playlist, play the previous video. */
fun previousVideo()
/** If the player is playing a playlist, play the video at position [index]. */
fun playVideoAt(index: Int)
/** If the player is playing a playlist, enable or disable looping of the playlist. */
fun setLoop(loop: Boolean)
/** If the player is playing a playlist, enable or disable shuffling of the playlist. */
fun setShuffle(shuffle: Boolean)
fun mute()
fun unMute()
/**
* @param volumePercent Integer between 0 and 100
*/
fun setVolume(volumePercent: Int)
/**
*
* @param time The absolute time in seconds to seek to
*/
fun seekTo(time: Float)
fun setPlaybackRate(playbackRate: PlayerConstants.PlaybackRate)
/**
* Tries to enter or exit fullscreen in the player.
*
* Might require setting the `origin` parameter to "https://www.youtube.com".
*/
fun toggleFullscreen()
fun addListener(listener: YouTubePlayerListener): Boolean
fun removeListener(listener: YouTubePlayerListener): Boolean
}