@@ -3,27 +3,29 @@ package org.schabi.newpipe.player.ui
33import org.schabi.newpipe.util.GuardedByMutex
44import java.util.Optional
55
6+ /* *
7+ * Creates a [PlayerUiList] starting with the provided player uis. The provided player uis
8+ * will not be prepared like those passed to [.addAndPrepare], because when
9+ * the [PlayerUiList] constructor is called, the player is still not running and it
10+ * wouldn't make sense to initialize uis then. Instead the player will initialize them by doing
11+ * proper calls to [.call].
12+ *
13+ * @param initialPlayerUis the player uis this list should start with; the order will be kept
14+ */
615class PlayerUiList (vararg initialPlayerUis : PlayerUi ) {
7- private val playerUis = GuardedByMutex (mutableListOf< PlayerUi >( ))
16+ private val playerUis = GuardedByMutex (mutableListOf ( * initialPlayerUis ))
817
918 /* *
19+ * Adds the provided player ui to the list and calls on it the initialization functions that
20+ /**
1021 * Creates a [PlayerUiList] starting with the provided player uis. The provided player uis
1122 * will not be prepared like those passed to [.addAndPrepare], because when
1223 * the [PlayerUiList] constructor is called, the player is still not running and it
1324 * wouldn't make sense to initialize uis then. Instead the player will initialize them by doing
1425 * proper calls to [.call].
1526 *
1627 * @param initialPlayerUis the player uis this list should start with; the order will be kept
17- */
18- init {
19- playerUis.runWithLockSync {
20- lockData.addAll(listOf (* initialPlayerUis))
21- }
22- }
23-
24- /* *
25- * Adds the provided player ui to the list and calls on it the initialization functions that
26- * apply based on the current player state. The preparation step needs to be done since when UIs
28+ */* apply based on the current player state. The preparation step needs to be done since when UIs
2729 * are removed and re-added, the player will not call e.g. initPlayer again since the exoplayer
2830 * is already initialized, but we need to notify the newly built UI that the player is ready
2931 * nonetheless.
0 commit comments