1. Jeggu's Avatar
    Could some one help to play m3u8 with encrypted, i can able to play m3u8 with plane key but due to some security reasons from back will be getting m3u8 with encrypted key.

    Code:

    public class ViewerActivity extends Activity implements Callback, OnPreparedListener, VideoControllerView.MediaPlayerControl{

    public static MediaPlayer player;
    public static SurfaceView surfaceView;
    public static SurfaceHolder surfaceHolder;
    VideoControllerView controller;
    boolean isPaused = false;
    @override
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_videoviewer);
    player = new MediaPlayer();
    //controller = new VideoControllerView(this);
    surfaceView = (SurfaceView)findViewById(R.id.videoSurface);
    surfaceHolder = surfaceView.getHolder();
    surfaceHolder.addCallback(this);
    player.setOnPreparedListener(this);

    Intent intent = getIntent();
    String url = intent.getStringExtra("URL");

    try {
    player.setAudioStreamType(AudioManager.STREAM_MUSIC);
    player.setDataSource(this, Uri.parse(url));
    } catch (IllegalArgumentException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (SecurityException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IllegalStateException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    @override
    public void onPrepared(MediaPlayer mp)
    {
    // TODO Auto-generated method stub
    int videoWidth = player.getVideoWidth();
    int videoHeight = player.getVideoHeight();
    android.view.ViewGroup.LayoutParams lp = surfaceView.getLayoutParams();
    lp.width = videoWidth;
    lp.height = videoHeight;
    surfaceView.setLayoutParams(lp);
    mp.start();

    }
    @override
    public void surfaceCreated(SurfaceHolder holder) {
    player.setDisplay(holder);
    if (isPaused) {
    player.start();
    isPaused = false;
    }
    else
    player.prepareAsync();

    }
    }
    10-25-2016 10:28 AM

Similar Threads

  1. How many people that didn't order would have if they could have...?
    By DaEXfactoR in forum Google Pixel & Pixel XL
    Replies: 10
    Last Post: 10-29-2016, 09:49 AM
  2. Any pre-existing Fi users having trouble with activation?
    By MRW1215 in forum Google Pixel & Pixel XL
    Replies: 10
    Last Post: 10-27-2016, 09:14 AM
  3. Unable to set up an additional yahoo account in Note 2
    By AC Question in forum Ask a Question
    Replies: 5
    Last Post: 10-25-2016, 03:40 PM
  4. Replies: 2
    Last Post: 10-25-2016, 11:43 AM
  5. Black screen and unresponsive with blue flashing light
    By AC Question in forum Ask a Question
    Replies: 0
    Last Post: 10-25-2016, 10:22 AM
LINK TO POST COPIED TO CLIPBOARD