在android中的vitamio播放器的情况下自适应比特率的配置

时间:2014-12-09 08:48:01

标签: android m3u8 vitamio

任何人都可以在自适应的情况下提供视频配置  比特率。我有一个基于smil的m3u8格式。是他们的任何选择  我们可以利用高清选项的搜索栏。我使用VITAMIO播放器  设备

public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        if (!LibsChecker.checkVitamioLibs(this))
            return;
        setContentView(R.layout.videoview);
        mEditText = (EditText) findViewById(R.id.url);
        //mVideoView = (VideoView) findViewById(R.id.surface_view);
        mVideoView=(io.vov.vitamio.widget.VideoView) findViewById(R.id.surface_view);
        if (path == "") {
            // Tell the user to provide a media file URL/path.
            Toast.makeText(this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show();
            return;
        } else {
            /*
             * Alternatively,for streaming media you can use
             * mVideoView.setVideoURI(Uri.parse(URLstring));
             */
            mVideoView.setVideoPath(path);
            mVideoView.setMediaController(new MediaController(this));
            mVideoView.requestFocus();

            mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mediaPlayer) {
                    // optional need Vitamio 4.0
                    mediaPlayer.setPlaybackSpeed(1.0f);
                    mediaPlayer.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH);
                    mediaPlayer.setAdaptiveStream(true);
                    //Log.d("**********************Testing   ",""+mediaPlayer.getCurrentFrame());
                    //Log.d("TESTING      dvdherdhdfhdfhdfh  ",""+MediaPlayer.VIDEOQUALITY_LOW);
                }
            });
        }

    }

    public void startPlay(View view) {
        String url = mEditText.getText().toString();
        path = url;
        if (!TextUtils.isEmpty(url)) {
            mVideoView.setVideoPath(url);
        }
    }

    public void openVideo(View View) {
      mVideoView.setVideoPath(path);
    }

0 个答案:

没有答案