add multiple streams button to test app

This commit is contained in:
Christian Schabesberger 2024-08-26 12:59:39 +02:00
parent 5102e0d9e1
commit 16b43aa89a
3 changed files with 55 additions and 18 deletions

View File

@ -60,11 +60,21 @@ class MainActivity : AppCompatActivity() {
binding = ActivityMainBinding.inflate(layoutInflater) binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
binding.startStreamButton.setOnClickListener { binding.start6502StreamButton.setOnClickListener {
newPlayer.playWhenReady = true newPlayer.playWhenReady = true
newPlayer.playStream("6502", PlayMode.EMBEDDED_VIDEO) newPlayer.playStream("6502", PlayMode.EMBEDDED_VIDEO)
} }
binding.startImuStreamButton.setOnClickListener {
newPlayer.playWhenReady = true
newPlayer.playStream("imu", PlayMode.EMBEDDED_VIDEO)
}
binding.startPortraitStreamButton.setOnClickListener {
newPlayer.playWhenReady = true
newPlayer.playStream("portrait", PlayMode.EMBEDDED_VIDEO)
}
videoPlayerViewModel.newPlayer = newPlayer videoPlayerViewModel.newPlayer = newPlayer
videoPlayerViewModel.contentFitMode = ContentScale.FIT_INSIDE videoPlayerViewModel.contentFitMode = ContentScale.FIT_INSIDE
@ -74,7 +84,7 @@ class MainActivity : AppCompatActivity() {
it.addViewToHideOnFullscreen(binding.buttonsLayout as View) it.addViewToHideOnFullscreen(binding.buttonsLayout as View)
it.addViewToHideOnFullscreen(binding.embeddedPlayerLayout as View) it.addViewToHideOnFullscreen(binding.embeddedPlayerLayout as View)
it.fullscreenPlayerView = binding.fullscreenPlayer it.fullscreenPlayerView = binding.fullscreenPlayer
it.rootView = findViewById(R.id.main) it.rootView = binding.root
} }
} }
} }

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- NewPlayer
<!-- NewPlayer
@author Christian Schabesberger @author Christian Schabesberger
@ -34,8 +33,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:minHeight="50dp" android:minHeight="50dp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -64,26 +63,39 @@
</LinearLayout> </LinearLayout>
<FrameLayout <LinearLayout
android:id="@+id/buttons_layout" android:id="@+id/buttons_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Start Stream" android:orientation="vertical"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toEndOf="@id/embedded_player_layout" app:layout_constraintStart_toEndOf="@id/embedded_player_layout"
app:layout_constraintTop_toTopOf="parent" > app:layout_constraintTop_toTopOf="parent">
<Button <Button
android:id="@+id/start_stream_button" android:id="@+id/start_6502_stream_button"
android:text="Start Stream"
android:layout_gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start 6502 Stream" />
</FrameLayout> <Button
android:id="@+id/start_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start IMU Stream" />
<Button
android:id="@+id/start_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start Landscape Stream" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -63,10 +63,11 @@
</LinearLayout> </LinearLayout>
<FrameLayout <LinearLayout
android:id="@id/buttons_layout" android:id="@id/buttons_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/embedded_player_layout" app:layout_constraintTop_toBottomOf="@id/embedded_player_layout"
@ -74,13 +75,27 @@
app:layout_constraintVertical_weight="1"> app:layout_constraintVertical_weight="1">
<Button <Button
android:id="@+id/start_stream_button" android:id="@+id/start_6502_stream_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="Start Stream" /> android:text="Start 6502 Stream" />
</FrameLayout> <Button
android:id="@+id/start_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start IMU Stream" />
<Button
android:id="@+id/start_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start Landscape Stream" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>