Skip to content

Commit

Permalink
display video size correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Mar 24, 2024
1 parent 69f0f55 commit fb58282
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/src/main/java/com/shajikhan/ladspa/amprack/Tracks.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
});

player = new ExoPlayer.Builder(context).build();
player.setVideoScalingMode (C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
tracksAdapter.player = player;

playPause = view.findViewById(R.id.tracks_play);
Expand Down Expand Up @@ -162,6 +163,11 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {


player.addListener(new Player.Listener() {
@Override
public void onVideoSizeChanged(VideoSize videoSize) {
Player.Listener.super.onVideoSizeChanged(videoSize);
surfaceView.getHolder().setFixedSize(videoSize.width, videoSize.height);
}
@Override
public void onPlaybackStateChanged(int playbackState) {
Player.Listener.super.onPlaybackStateChanged(playbackState);
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
<string-array name="camera_orientations">
<item>Portrait</item>
<item>Landscape</item>
<item>Reverse Portrait</item>
<item>Reverse Landscape</item>
</string-array>
<string-array name="c_o_values">
<item>0</item>
<item>90</item>
<item>180</item>
<item>360</item>
</string-array>
<string-array name="channels">
<item>Mono</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/camera_settings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<DropDownPreference
<ListPreference
android:defaultValue="0"
android:entries="@array/camera_orientations"
android:entryValues="@array/c_o_values"
Expand Down

0 comments on commit fb58282

Please sign in to comment.