I want to play local videos in crosswalk webview. I'm getting the video path from an intent opening my activity, so it could be stored internally or on sd card.
Using this url file:///storage/emulated/0/Download/movies/movie.mp4
i get Failed to load resource: net::ERR_ACCESS_DENIED
.
Using input file dialog with URL.createObjectURL(file);
it works. But because i know the path, i dont want to select it again manually. Setting the value of input file is forbidden.
Creating a url using the path is also not possible, because it needs file or blob.
Because of possible big filesize its not possible to temporarily copy it to sd card.
This gives me file not found error:
@Override
public WebResourceResponse shouldInterceptLoadRequest(XWalkView view,
String url) {
if(url.contains("file:///storage")){
try {
return new WebResourceResponse("video/*", "UTF-8", new FileInputStream(url));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
return super.shouldInterceptLoadRequest(view, url);
}
also i have defined <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
other questions on stackoverflow asking for accessing assets, so i created this new question