正在显示
2 个修改的文件
包含
15 行增加
和
4 行删除
| @@ -8,6 +8,7 @@ import com.github.ajalt.timberkt.Timber | @@ -8,6 +8,7 @@ import com.github.ajalt.timberkt.Timber | ||
| 8 | import com.google.android.material.tabs.TabLayoutMediator | 8 | import com.google.android.material.tabs.TabLayoutMediator |
| 9 | import com.snakydesign.livedataextensions.combineLatest | 9 | import com.snakydesign.livedataextensions.combineLatest |
| 10 | import com.xwray.groupie.GroupieAdapter | 10 | import com.xwray.groupie.GroupieAdapter |
| 11 | +import io.livekit.android.room.track.LocalVideoTrack | ||
| 11 | import io.livekit.android.sample.databinding.CallActivityBinding | 12 | import io.livekit.android.sample.databinding.CallActivityBinding |
| 12 | import kotlinx.parcelize.Parcelize | 13 | import kotlinx.parcelize.Parcelize |
| 13 | 14 | ||
| @@ -55,6 +56,16 @@ class CallActivity : AppCompatActivity() { | @@ -55,6 +56,16 @@ class CallActivity : AppCompatActivity() { | ||
| 55 | tabLayoutMediator?.attach() | 56 | tabLayoutMediator?.attach() |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 59 | + viewModel.room.observe(this) { room -> | ||
| 60 | + room.initVideoRenderer(binding.pipVideoView) | ||
| 61 | + val localParticipant = room.localParticipant | ||
| 62 | + if (localParticipant != null) { | ||
| 63 | + val videoTrack = localParticipant.localVideoTrackPublications | ||
| 64 | + .firstOrNull() | ||
| 65 | + ?.track as? LocalVideoTrack | ||
| 66 | + videoTrack?.addRenderer(binding.pipVideoView) | ||
| 67 | + } | ||
| 68 | + } | ||
| 58 | val audioManager = getSystemService(AUDIO_SERVICE) as AudioManager | 69 | val audioManager = getSystemService(AUDIO_SERVICE) as AudioManager |
| 59 | with(audioManager) { | 70 | with(audioManager) { |
| 60 | isSpeakerphoneOn = true | 71 | isSpeakerphoneOn = true |
| @@ -17,12 +17,12 @@ | @@ -17,12 +17,12 @@ | ||
| 17 | app:layout_constraintBottom_toBottomOf="parent" | 17 | app:layout_constraintBottom_toBottomOf="parent" |
| 18 | app:layout_constraintTop_toBottomOf="@id/tabs" /> | 18 | app:layout_constraintTop_toBottomOf="@id/tabs" /> |
| 19 | 19 | ||
| 20 | - <!-- | ||
| 21 | <org.webrtc.SurfaceViewRenderer | 20 | <org.webrtc.SurfaceViewRenderer |
| 22 | android:id="@+id/pip_video_view" | 21 | android:id="@+id/pip_video_view" |
| 23 | android:layout_height="144dp" | 22 | android:layout_height="144dp" |
| 24 | - android:layout_width="wrap_content" | ||
| 25 | - android:layout_gravity="bottom|end" | 23 | + android:layout_width="0dp" |
| 24 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 25 | + app:layout_constraintEnd_toEndOf="parent" | ||
| 26 | + app:layout_constraintStart_toStartOf="parent" | ||
| 26 | android:layout_margin="16dp" /> | 27 | android:layout_margin="16dp" /> |
| 27 | - --> | ||
| 28 | </androidx.constraintlayout.widget.ConstraintLayout> | 28 | </androidx.constraintlayout.widget.ConstraintLayout> |
-
请 注册 或 登录 后发表评论