加上註解

This commit is contained in:
Raymond Yang 2023-02-03 12:24:43 +08:00
parent 4e09a449ca
commit a37e79d841

View File

@ -73,6 +73,7 @@ class VideoView : ConstraintLayout, SurfaceHolder.Callback, GstCallback {
gstLibrary = GstLibrary(context)
gstLibrary.setOnStatusChangeListener(this)
// View 預設狀態
view.textDeviceName.isVisible = false
isPlaying = false
isLoading = false
@ -89,9 +90,9 @@ class VideoView : ConstraintLayout, SurfaceHolder.Callback, GstCallback {
this.tag = device.deviceName
view.textDeviceName.text = device.deviceName
view.textDeviceName.isVisible = true
val rtspUrl = this.data?.getStreamPath(streamType) ?: return
Log.d("${TAG}_$tag", "Set device to: $device, rtspUrl = $rtspUrl")
val rtspUrl = this.data?.getStreamPath(streamType) ?: return // 如果 null 就不指派給 Gstreamer 了
gstLibrary.setRtspUrl(rtspUrl)
Log.d("${TAG}_$tag", "Set device to: $device, rtspUrl = $rtspUrl")
}
fun setTextVisible(isVisible: Boolean) {
@ -134,7 +135,6 @@ class VideoView : ConstraintLayout, SurfaceHolder.Callback, GstCallback {
override fun surfaceDestroyed(p0: SurfaceHolder) {
Log.d("${TAG}_$tag", "Surface destroyed")
// TODO: 呼叫 releaseSurface() 會閃退,目前仍在釐清時機點
if (this::gstLibrary.isInitialized) {
gstLibrary.releaseSurface()
}