setSubtitleView方法已经被移除,可以使用setSubtitleViewListener来监听字幕的变化。具体实现如下:

playerView.setSubtitleViewListener(new SubtitleView.OnChangedListener() {
    @Override
    public void onChanged(SubtitleView subtitleView) {
        // 字幕变化时的处理
    }
});

如果需要自定义字幕的显示样式,可以通过实现SubtitleView的子类来实现。例如:

public class CustomSubtitleView extends SubtitleView {
    public CustomSubtitleView(Context context) {
        super(context);
        // 自定义字幕的样式
        // ...
    }
}

然后在代码中使用自定义的字幕视图:

CustomSubtitleView subtitleView = new CustomSubtitleView(context);
playerView.setSubtitleView(subtitleView);

标签: 综合


原文地址: https://gggwd.com/t/topic/b7z3 著作权归作者所有。请勿转载和采集!