Question

I have literally tried everything, but I can't get my SubRip-subtitles to work in Vitamio. Is it maybe because subtitles aren't supported whilst streaming videos? I'd like to know. English Vitamio support sucks.

Here's what I've come up with:

    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

        }
    }
Was it helpful?

Solution

You can download VitamioBundle, vitamio-sample had a sample for subtitle support.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top