Skip to content

Commit

Permalink
Start Video without Audio Focus (PierfrancescoSoffritti#896)
Browse files Browse the repository at this point in the history
* Update readme (PierfrancescoSoffritti#875)

Add Genius to the apps that are using the library

* added mute option

* added mute option

* changed wording of new method descriptions

* removed link in README.md

Co-authored-by: Pierfrancesco Soffritti <soffritti.pierfrancesco@gmail.com>
  • Loading branch information
2 people authored and Pierfrancesco Soffritti committed Mar 13, 2023
1 parent 15e002d commit bda3b48
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class IFramePlayerOptions private constructor(private val playerOptions: JSONObj
class Builder {
companion object {
private const val AUTO_PLAY = "autoplay"
private const val MUTE = "mute"
private const val CONTROLS = "controls"
private const val ENABLE_JS_API = "enablejsapi"
private const val FS = "fs"
Expand All @@ -42,6 +43,7 @@ class IFramePlayerOptions private constructor(private val playerOptions: JSONObj

init {
addInt(AUTO_PLAY, 0)
addInt(MUTE, 0)
addInt(CONTROLS, 0)
addInt(ENABLE_JS_API, 1)
addInt(FS, 0)
Expand All @@ -66,6 +68,24 @@ class IFramePlayerOptions private constructor(private val playerOptions: JSONObj
return this
}

/**
* Controls if the video is played automatically after the player is initialized.
* @param autoplay if set to 1: the player will start automatically. If set to 0: the player will not start automatically
*/
fun autoplay(controls: Int): Builder {
addInt(AUTO_PLAY, controls)
return this
}

/**
* Controls if the player will be initialized mute or not.
* @param mute if set to 1: the player will start muted and without acquiring Audio Focus. If set to 0: the player will acquire Audio Focus
*/
fun mute(controls: Int): Builder {
addInt(MUTE, controls)
return this
}

/**
* Controls the related videos shown at the end of a video.
* @param rel If set to 0: related videos will come from the same channel as the video that was just played. If set to 1: related videos will come from multiple channels.
Expand Down

0 comments on commit bda3b48

Please sign in to comment.