mdtuyen
mdtuyen

Reputation: 4548

How to open blob link use webview of android?

I want to display video in android app.

The link of video is blob link so that i think i need use webview to display it.

How to implement it?

Upvotes: 0

Views: 602

Answers (1)

Zamrony P. Juhara
Zamrony P. Juhara

Reputation: 5262

WebView support loading HTML data from string. So following code is possible.

 String videoBlobLinkUrl = "data:video/mp4;base64,[video base64-encoded data ..]";
 String videoBlobMime = "video/mp4";

 String videoHtml = "<html><body><video><source type=\""+videoBlobMime+"\" src=\""+ videoBlobLinkUrl +"\"></video></body></html>";
 webview.loadData(videoHtml, "text/html", null);

Upvotes: 1

Related Questions