將停止播放函數改成手動呼叫,測試看看是否還會容易閃退
This commit is contained in:
parent
de152da749
commit
9fc8673715
@ -52,7 +52,13 @@ class MainActivity : AppCompatActivity() {
|
||||
registerOnPageChangeCallback(object: ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
splitVideoViewAdapter.stop(currentPage)
|
||||
currentPage = position
|
||||
Log.d("Split", "currentPage: $currentPage")
|
||||
/*for (i in 0 until splitVideoViewAdapter.itemCount) {
|
||||
if (i == currentPage) continue
|
||||
splitVideoViewAdapter.stop(i)
|
||||
}*/
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -55,14 +55,17 @@ class SplitViewFragment : Fragment() {
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
stopAll()
|
||||
//stopAll()
|
||||
super.onPause()
|
||||
Log.d("${TAG}_$mPageNum", "onPause()")
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
playAll()
|
||||
MainScope().launch {
|
||||
delay(1000)
|
||||
playAll()
|
||||
}
|
||||
Log.d("${TAG}_$mPageNum", "onResume()")
|
||||
}
|
||||
|
||||
@ -176,7 +179,7 @@ class SplitViewFragment : Fragment() {
|
||||
for (index in data.indices) {
|
||||
videoViews[index].stopRetryCount()
|
||||
videoViews[index].stop()
|
||||
delay(300)
|
||||
delay(500)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user