diff --git a/app/src/main/java/github/kairusds/libvlcandroidtest/MainActivity.java b/app/src/main/java/github/kairusds/libvlcandroidtest/MainActivity.java index cfec1f1..8a873d9 100644 --- a/app/src/main/java/github/kairusds/libvlcandroidtest/MainActivity.java +++ b/app/src/main/java/github/kairusds/libvlcandroidtest/MainActivity.java @@ -1,7 +1,6 @@ package github.kairusds.libvlcandroidtest; import android.content.Context; -import android.media.AudioManager; import android.os.Build; import android.os.Bundle; import android.view.View; @@ -11,7 +10,6 @@ import org.videolan.libvlc.LibVLC; import org.videolan.libvlc.Media; import org.videolan.libvlc.MediaPlayer; -import org.videolan.libvlc.util.HWDecoderUtil; import org.videolan.libvlc.util.VLCVideoLayout; import java.io.IOException; @@ -26,7 +24,6 @@ public class MainActivity extends AppCompatActivity { private LibVLC mLibVLC = null; private MediaPlayer mMediaPlayer = null; - private int audiotrackSessionId = 0; @Override protected void onCreate(Bundle savedInstanceState){ @@ -37,18 +34,11 @@ protected void onCreate(Bundle savedInstanceState){ mLibVLC = new LibVLC(this, getOptions()); mMediaPlayer = new MediaPlayer(mLibVLC); - mMediaPlayer.setAudioOutput(((HWDecoderUtil.getAudioOutputFromDevice() == HWDecoderUtil.AudioOutput.OPENSLES) ? "opensles_android" : null)); + mMediaPlayer.setAudioOutput("opensles_android"); mVideoLayout = findViewById(R.id.video_layout); } - private void init(){ - if(audiotrackSessionId == 0){ - AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); - audiotrackSessionId = audioManager.generateAudioSessionId(); - } - } - private ArrayList getOptions(){ final ArrayList options = new ArrayList<>(); options.add("--no-audio-time-stretch"); @@ -60,7 +50,6 @@ private ArrayList getOptions(){ options.add("0"); options.add("--audio-resampler"); options.add("soxr"); // use soxr for audio resampling - options.add("--audiotrack-session-id=" + audiotrackSessionId); options.add("-v"); // minimum vlc logging options.add("--preferred-resolution=-1"); // use maximum resolution