0

我确实尝试了所有方法,但我无法让我的 SubRip 字幕在 Vitamio 中工作。是否可能是因为流式传输视频时不支持字幕?我想知道。英语 Vitamio 支持很烂。

这是我想出的:

    public class StreamVideoActivity extends FragmentActivity implements OnSubtitleUpdateListener {
        //Variables
        VideoView streamingVideo;
        TextView subtitleText;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_stream_video);

            subtitleText = (TextView) findViewById(R.id.subText);
            streamingVideo = (VideoView) findViewById(R.id.videoView);

            //BLABLABLABLA

            streamingVideo.setVideoPath(fileUrl);
            streamingVideo.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH);
            streamingVideo.setMediaController(mediaController);
            streamingVideo.setBufferSize(512);
            streamingVideo.setOnPreparedListener(new OnPreparedListener(){

                @Override
                public void onPrepared(MediaPlayer arg0) {
                    streamingVideo.setSubPath(subtitleFile.getPath());
                    streamingVideo.setSubShown(true);
                    streamingVideo.setSubEncoding(null);
                    streamingVideo.setSubTrack(MediaPlayer.SUBTITLE_EXTERNAL);
                    streamingVideo.setOnSubtitleUpdateListener(this);
                    streamingVideo.start();
                }
            }
        }
        @Override
        public void onSubtitleUpdate(final String arg0) {
            if (arg0 != null) {
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        subtitleText.setText(arg0);
                    }
                });
            }
        }

        @Override
        public void onSubtitleUpdate(byte[] arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

        }
    }
4

1 回答 1

0

您可以下载VitamioBundle, vitamio-sample 有一个用于字幕支持的示例。

于 2013-08-18T16:27:43.617 回答