1

How is it possible to enable subtitles which are online in a server using its URL for a video playing from a URL???? I am using this code for the video:

public class VideoViewActivity extends Activity {

// Declare variables
ProgressDialog pDialog;
VideoView videoview;

// Insert your Video URL
String VideoURL = "http://**************/mp4/Despicable.Me.2.2013.mp4";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Get the layout from video_main.xml
    setContentView(R.layout.videoview_main);
    // Find your VideoView in your video_main.xml layout
    videoview = (VideoView) findViewById(R.id.VideoView);
    // Execute StreamVideo AsyncTask

    // Create a progressbar
    pDialog = new ProgressDialog(VideoViewActivity.this);
    // Set progressbar title
    pDialog.setTitle("Android Video Streaming Tutorial");
    // Set progressbar message
    pDialog.setMessage("Buffering...");
    pDialog.setIndeterminate(false);
    pDialog.setCancelable(false);
    // Show progressbar
    pDialog.show();

    try {
        // Start the MediaController
        MediaController mediacontroller = new MediaController(
                VideoViewActivity.this);
        mediacontroller.setAnchorView(videoview);
        // Get the URL from String VideoURL
        Uri video = Uri.parse(VideoURL);
        videoview.setMediaController(mediacontroller);
        videoview.setVideoURI(video);

    } catch (Exception e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
    }

    videoview.requestFocus();
    videoview.setOnPreparedListener(new OnPreparedListener() {
        // Close the progress bar and play the video
        public void onPrepared(MediaPlayer mp) {
            pDialog.dismiss();
            videoview.start();
        }
    });

}

}

the .srt file is in the same directory in the server

makis.k
  • 432
  • 6
  • 23
  • possible duplicate of [Android MediaPlayer/VideoView w/Subtitles (SRT)](http://stackoverflow.com/questions/11403134/android-mediaplayer-videoview-w-subtitles-srt) – skynet Oct 26 '13 at 16:31
  • i saw your link but i dont think i got an answer from there! is there an example which demonstrates this http://www.ittiam.com/IttiamAdmin/Downloads/RenderingSubtitlesinAndroid201192914525892.pdf – makis.k Oct 26 '13 at 16:34

0 Answers0