0
votes

I am trying to play a video which is stored in sdcard in an android device using video tag of html5 in webview in my android app. The path of the video is stored in the server database and passed to the webview as "file:///storage/extSdCard/344048250.mp4" Video wouldn't load at all. What am I doing wrong? When I do the same with a html page in local device it self, the video will play! please help! device: Samsung Tab 3 (android version 4.4.2)

$("img").click(function(){
            var tagID = $(this).attr('id');
            console.log(local_locations[tagID]);
            if(tagID >= 0)
            $(this).replaceWith("<video id =\"tagID\" width=\"100%\" controls><source src=\""+local_locations[tagID]+"\" ></video>");

This is the code I used to load the video tag. I replaced an image with the video tag

1

1 Answers

1
votes

This seems like a problem faced by many. WebView of android doesn't give you permission to access local files. Also, not any browsers would let you access local files when you are calling it from a remote domain. If your web page is called using http protocol and you are trying to access a file:/// it is restricted. check this out: http://www.websina.com/bugzero/kb/browser-file-url.html