調整releaseSurface的呼叫時機
This commit is contained in:
@@ -114,6 +114,7 @@ class MainActivity : AppCompatActivity() {
|
||||
binding.viewPager.setCurrentItem(0, false)
|
||||
for (i in 0 until splitVideoViewAdapter.itemCount) {
|
||||
splitVideoViewAdapter.pause(i)
|
||||
splitVideoViewAdapter.destroy(i)
|
||||
}
|
||||
//delay(oldSplitMode * Constants.CONF_DELAY_BASE_MILLIS)
|
||||
delay((oldSplitMode * 100) + Constants.CONF_DELAY_BASE_MILLIS)
|
||||
|
||||
+3
-3
@@ -83,10 +83,10 @@ class SplitViewFragment : Fragment() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
//destroyAll()
|
||||
stopAll()
|
||||
Log.d("${TAG}_$mPageNum", "onDestroy()")
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
@@ -214,8 +214,8 @@ class SplitViewFragment : Fragment() {
|
||||
fun destroyAll() /*= MainScope().launch(Dispatchers.Main)*/ {
|
||||
if (videoViews.isEmpty()) return
|
||||
for (index in data.indices) {
|
||||
videoViews[index].destroy()
|
||||
//delay(100)
|
||||
//videoViews[index].destroy()
|
||||
videoViews[index].destroySurface()
|
||||
}
|
||||
}//.start()
|
||||
|
||||
|
||||
@@ -105,8 +105,9 @@ class VideoView : ConstraintLayout, GstCallback {
|
||||
|
||||
fun play() {
|
||||
if (data == null) return
|
||||
videoView.postInvalidate()
|
||||
gstLibrary.play()
|
||||
if (this::gstLibrary.isInitialized) {
|
||||
gstLibrary.play()
|
||||
}
|
||||
}
|
||||
|
||||
fun pause() {
|
||||
@@ -117,6 +118,12 @@ class VideoView : ConstraintLayout, GstCallback {
|
||||
}
|
||||
}
|
||||
|
||||
fun destroySurface() {
|
||||
if (this::gstLibrary.isInitialized) {
|
||||
gstLibrary.releaseSurface()
|
||||
}
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
if (this::gstLibrary.isInitialized) {
|
||||
gstLibrary.close()
|
||||
|
||||
Reference in New Issue
Block a user