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