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