How to play video URL inside android webview

后端 未结 10 1481
谎友^
谎友^ 2020-12-10 12:51

I want to play video url inside my application webview but when i am run the application it showing only white screen . i had read some post on this and i have used that cod

10条回答
  •  离开以前
    2020-12-10 13:17

    I also got stuck with this issue. I got correct response from server, but couldn`t play video. After long time I found a solution here. Maybe, in future this link will be invalid. So, here is my correct code

    Uri video = Uri.parse("Your link should be in this place "); 
    mVideoView.setVideoURI(video); 
    
    mVideoView.setZOrderOnTop(true); //Very important line, add it to Your code
    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { 
        @Override 
        public void onPrepared(MediaPlayer mediaPlayer) {
       // here write another part of code, which provides starting the video
    }}
    

提交回复
热议问题