1

I'm trying to play a video from my WebView, I've solved it... well sort of, but there is one problem. As for now, I've added an image with an onclick function named "playVideo"

public void playVideo(View V)
{
    String LINK = "*URL TO VIDEO*";
    setContentView(R.layout.video_activity);
    VideoView videoView = (VideoView) findViewById(R.id.video);
    MediaController mc = new MediaController(this);
    mc.setAnchorView(videoView);
    mc.setMediaPlayer(videoView);
    Uri video = Uri.parse(LINK);
    videoView.setMediaController(mc);
    videoView.setVideoURI(video);
    videoView.start();
}

When you press it, it opens up an activity with a "VideoView".

The problem:
I'm loading the video from a server and there will be new videos that will be uploaded and I would like to implement support for videos beeing played (run the "playVideo"-method) straight from the webpage that the webview shows.

Hope you understand what I mean.
Basicly; I want to click the < video >-tag (html5) open up video_activity and play video.

intINk
  • 129
  • 1
  • 12

1 Answers1

1

I may have inadvertently posted this answer previously in the wrong place... I converted the video file to a base64 string and fed it directly into the source, vola! The webview is no longer confused by the asset location

<video width="400"  height="225" controls="controls" align="center" poster="data:image/poster.jpg" >
<source id="bigd" src="data:video/mp4;charset=utf-8;base64,AAAAHGZ0eXBtcDQyAAAAAG1...(etc.)">
</video>
aegsomweb
  • 83
  • 1
  • 9
  • I thought the problem was that the WebView wasnt able to read video-tags? – intINk Mar 21 '13 at 19:16
  • Seems to be a problem with the asset location hence including the asset in the actual page...this sort of worked, but rather than a final solution it proved to be a bit of a blind alley... – aegsomweb Apr 16 '13 at 11:59