Http Live Streaming on Android 4 (Ice Cream Sandwich)

18,322

Solution 1

Try the following :

    String httpLiveUrl = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
    videoView.setVideoURI(Uri.parse(httpLiveUrl));
    videoView.setMediaController(new MediaController(this));
    videoView.requestFocus();
    videoView.start();

OR

Try using the VitaMio media player

HTTP live streaming (M3U8), for Android 2.1+

edit: The VitaMio player is dead


I think this will work just fine in the actual device, since it works in HoneyComb, the emulator can be broken sometimes

Solution 2

Looks like this might not be fully supported in the emulator. This runs fine on a ICS device

Share:
18,322
Jay
Author by

Jay

Updated on June 22, 2022

Comments

  • Jay
    Jay almost 2 years

    I would like to play a http live steaming link(.m3u8) on android. Can you please let me know how to write code for that (snippet)?

    I tried the following(on Activity's onCreate event) but it wouldnt work (says Cant play video) :

    VideoView vv = new VideoView(this);
    Uri uri =Uri.parse("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8");
    vv.setVideoURI(uri);
    setContentView(vv);
    

    note: using emulator for testing thanks for the help

  • Jay
    Jay over 12 years
    thanks Reno, But I came to know that android 3+ have default support for http live streaming(HLS). Since I will be developing only for android 4, is VitaMio required ?
  • Reno
    Reno over 12 years
    There are some known issues with it. The emulator is not reliable it seems.
  • Jay
    Jay over 12 years
    reno, it doesnt seem to work. What I did was : In the Acitivity's onCreate function I added - VideoView videoView = new VideoView(this);<pasted you code>;setContentView(videoView); - When i run this I get following in logCat: 1. D - MediaPlayer - Couldnt open files on client side, trying server side 2. E - MediaPlayer - error(1, -2147483648) and two other line with same error messages as second one. On the emulator the output is "Cant play video" dialog.
  • Reno
    Reno over 12 years
    You have a ICS device? It is not released yet
  • Rajdeep Dua
    Rajdeep Dua over 12 years
    Note: I am part of the android devrel team at Google
  • yorkw
    yorkw over 12 years
    +1 This is the correct way to do it on Emulator, I am using same piece of code in two of my Android projects without any problem. Note, for some real device, httplive doesn't work, need change it back to http.
  • Roman Nurik
    Roman Nurik over 12 years
    the httplive scheme is not supported.
  • Abhi
    Abhi over 12 years
    Reno is there any other way to play m3u8 file with out using Third party library
  • BlueVoodoo
    BlueVoodoo almost 12 years
    Did anyone get this working? I get the same prob as @Jay on Anroid 4.0.3.