調整onResume

This commit is contained in:
Raymond Yang 2023-03-06 17:08:20 +08:00
parent 1b80ae3349
commit 48db07290c

View File

@ -78,12 +78,7 @@ class SplitViewFragment : Fragment() {
override fun onResume() {
super.onResume()
//if (viewModel.activePage.value == mPageNum) {
MainScope().launch {
//delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
playAll()
}
//}
playAll()
Log.d("${TAG}_$mPageNum", "onResume()")
}
@ -167,7 +162,7 @@ class SplitViewFragment : Fragment() {
}
MainScope().launch {
stopAll()
//delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
//delay((splitMode * 100) + Constants.CONF_DELAY_BASE_MILLIS)
val item = data[position]
val bundle = Bundle().apply {
@ -195,16 +190,16 @@ class SplitViewFragment : Fragment() {
}
}
fun playAll() /*= MainScope().launch(Dispatchers.Main)*/ {
if (videoViews.isEmpty()) return
//delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
fun playAll() = MainScope().launch(Dispatchers.Main) {
if (videoViews.isEmpty()) return@launch
delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
for (index in data.indices) {
if (!videoViews[index].isReady) continue
videoViews[index].resetRetryCount()
videoViews[index].play()
//delay(300)
}
}//.start()
}.start()
fun stopAll() /*= MainScope().launch(Dispatchers.Main)*/ {
if (videoViews.isEmpty()) return