File tree 1 file changed +9
-5
lines changed
player_component/src/main/java/com/xyoye/player/controller/danmu
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,13 @@ class DanmuView(
76
76
post {
77
77
isDanmuLoaded = true
78
78
if (mControlWrapper.isPlaying()) {
79
- val position =
79
+ val position = if (mSeekPosition == INVALID_VALUE ) {
80
80
mControlWrapper.getCurrentPosition() + PlayerInitializer .Danmu .offsetPosition
81
- start(position)
81
+ } else {
82
+ mSeekPosition
83
+ }
84
+ seekTo(position)
85
+ mSeekPosition = INVALID_VALUE
82
86
}
83
87
}
84
88
}
@@ -108,7 +112,7 @@ class DanmuView(
108
112
}
109
113
}
110
114
PlayState .STATE_BUFFERING_PAUSED -> {
111
- if (isPrepared){
115
+ if (isPrepared) {
112
116
pause()
113
117
}
114
118
}
@@ -157,7 +161,7 @@ class DanmuView(
157
161
}
158
162
159
163
fun seekTo (timeMs : Long , isPlaying : Boolean ) {
160
- if (isPlaying) {
164
+ if (isPlaying && isDanmuLoaded ) {
161
165
seekTo(timeMs + PlayerInitializer .Danmu .offsetPosition)
162
166
} else {
163
167
mSeekPosition = timeMs + PlayerInitializer .Danmu .offsetPosition
@@ -344,7 +348,7 @@ class DanmuView(
344
348
addDanmaku(danmaku)
345
349
}
346
350
347
- fun setSpeed (speed : Float ){
351
+ fun setSpeed (speed : Float ) {
348
352
mDanmakuContext.setSpeed(speed)
349
353
}
350
354
You can’t perform that action at this time.
0 commit comments