How to play live streaming in android application?

后端 未结 3 1491
北荒
北荒 2020-12-30 10:02

I want to make application for cricket live streaming. I want to know following things :

  1. From where I can found the links to play cricket streaming ?
3条回答
  •  再見小時候
    2020-12-30 10:35

    Try this:

    private void playLive(String path){
    
       try {
            mMediaPlayer = new MediaPlayer();
            mMediaPlayer.setDataSource(path);
            mMediaPlayer.setDisplay(holder);
            mMediaPlayer.prepare();
            mMediaPlayer.setOnBufferingUpdateListener(this);
            mMediaPlayer.setOnCompletionListener(this);
            mMediaPlayer.setOnPreparedListener(this);
            mMediaPlayer.setOnVideoSizeChangedListener(this);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
          } catch (Exception e) {
            Log.e(TAG, "error: " + e.getMessage(), e);
          }
    }
    

提交回复
热议问题