我正在使用名为ExoPlayer的谷歌新MediaPlayer,无法找到静音的方法
是否有一种简单的方法可以在Google ExoPlayer上静音音轨?还是改变音量?
我已经为 ExoPlayer 的 Design Custom Seekbar尝试过这个和这个,但没有运气。
我想为 ExoPlayer 设计自定义拇指和进度条。以下是 ExoPlayer 的 XML,我曾尝试在其中放置搜索栏,但没有按预期出现。
<com.google.android.exoplayer.AspectRatioFrameLayout
android:id="@+id/video_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<SurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"/>
<View
android:id="@+id/shutter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"/>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/thumb"/>
<com.google.android.exoplayer.text.SubtitleLayout
android:id="@+id/subtitles"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.exoplayer.AspectRatioFrameLayout>
Run Code Online (Sandbox Code Playgroud)
还有一个问题是我如何为 ExoPlayer 设置自定义音量控件,就像我们在MXPlayer 中一样(音量垂直条)。
我已经得到了SeekBar使用这种方法。
SeekBar seekBar = (SeekBar) mediaController.findViewById(getResources().getIdentifier("mediacontroller_progress","id","android"));
seekBar.setThumb(getResources().getDrawable(R.drawable.player_thumb));
Run Code Online (Sandbox Code Playgroud)
现在唯一要做的就是像MXPlayer一样获得垂直音量控制。