Setup texture view listener for participant devices in platform helpers
This commit is contained in:
parent
36047921b8
commit
1af9954606
1 changed files with 3 additions and 37 deletions
|
@ -19,7 +19,6 @@
|
|||
*/
|
||||
package org.linphone.activities.voip.data
|
||||
|
||||
import android.graphics.SurfaceTexture
|
||||
import android.view.TextureView
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
|
@ -155,45 +154,12 @@ class ConferenceParticipantDeviceData(
|
|||
fun setTextureView(tv: TextureView) {
|
||||
textureView = tv
|
||||
|
||||
if (tv.isAvailable) {
|
||||
Log.i("[Conference Participant Device] Setting textureView [$textureView] for participant [${participantDevice.address.asStringUriOnly()}]")
|
||||
updateWindowId(textureView)
|
||||
} else {
|
||||
Log.i("[Conference Participant Device] Got textureView [$textureView] for participant [${participantDevice.address.asStringUriOnly()}], but it is not available yet")
|
||||
tv.surfaceTextureListener = object : TextureView.SurfaceTextureListener {
|
||||
override fun onSurfaceTextureAvailable(
|
||||
surface: SurfaceTexture,
|
||||
width: Int,
|
||||
height: Int
|
||||
) {
|
||||
Log.i("[Conference Participant Device] Setting textureView [$textureView] for participant [${participantDevice.address.asStringUriOnly()}]")
|
||||
updateWindowId(textureView)
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureSizeChanged(
|
||||
surface: SurfaceTexture,
|
||||
width: Int,
|
||||
height: Int
|
||||
) { }
|
||||
|
||||
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture): Boolean {
|
||||
Log.w("[Conference Participant Device] TextureView [$textureView] for participant [${participantDevice.address.asStringUriOnly()}] has been destroyed")
|
||||
textureView = null
|
||||
updateWindowId(null)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) { }
|
||||
}
|
||||
}
|
||||
Log.i("[Conference Participant Device] Setting textureView [$textureView] for participant [${participantDevice.address.asStringUriOnly()}]")
|
||||
updateWindowId(textureView)
|
||||
}
|
||||
|
||||
private fun updateWindowId(windowId: Any?) {
|
||||
if (isMe) {
|
||||
coreContext.core.nativePreviewWindowId = windowId
|
||||
} else {
|
||||
participantDevice.nativeVideoWindowId = windowId
|
||||
}
|
||||
participantDevice.nativeVideoWindowId = windowId
|
||||
}
|
||||
|
||||
private fun isVideoAvailableAndSendReceive(): Boolean {
|
||||
|
|
Loading…
Reference in a new issue