@@ -25,6 +25,7 @@ import com.xyoye.player.controller.video.LoadingView
25
25
import com.xyoye.player.controller.video.PlayerBottomView
26
26
import com.xyoye.player.controller.video.PlayerGestureView
27
27
import com.xyoye.player.controller.video.PlayerTopView
28
+ import com.xyoye.player.info.PlayerInitializer
28
29
import com.xyoye.player.utils.MessageTime
29
30
import com.xyoye.player_component.R
30
31
import com.xyoye.player_component.databinding.LayoutPlayerControllerBinding
@@ -60,6 +61,7 @@ class VideoController(
60
61
61
62
private var mDanmuSourceChanged: ((String , Int ) -> Unit )? = null
62
63
private var mSubtitleSourceChanged: ((String ) -> Unit )? = null
64
+ private var switchVideoSourceBlock: ((Int ) -> Unit )? = null
63
65
64
66
private val controllerBinding = DataBindingUtil .inflate<LayoutPlayerControllerBinding >(
65
67
LayoutInflater .from(context),
@@ -145,6 +147,13 @@ class VideoController(
145
147
super .onPlayStateChanged(playState)
146
148
if (playState == PlayState .STATE_PLAYING ) {
147
149
considerSeekToLastPlay()
150
+ } else if (playState == PlayState .STATE_COMPLETED ) {
151
+ if (PlayerInitializer .Player .isAutoPlayNext) {
152
+ val videoSource = mControlWrapper.getVideoSource()
153
+ if (videoSource.hasNextSource()) {
154
+ switchVideoSourceBlock?.invoke(videoSource.getGroupIndex() + 1 )
155
+ }
156
+ }
148
157
}
149
158
}
150
159
@@ -250,6 +259,7 @@ class VideoController(
250
259
* 切换视频资源回调
251
260
*/
252
261
fun setSwitchVideoSourceBlock (block : (Int ) -> Unit ) {
262
+ this .switchVideoSourceBlock = block
253
263
playerBotView.setSwitchVideoSourceBlock(block)
254
264
mSettingController.setSwitchVideoSourceBlock(block)
255
265
}
0 commit comments