0

I have a javascript (inside of an html file) to load and reproduce the videos by streaming in my android app, so I am trying to use a webview to display the video. My problem is that the file is not in a server, but it is a project resource (I mean it is in the project directory, exactly in /res/raw/video_player.html) and I want to call a specific function of the javascript passing the video url as param.

Does anyone have an idea about how to do this?

Thanks in advance.

Tony_craft
  • 213
  • 1
  • 10

1 Answers1

0

If I understand correctly you wish to set the src attribute of your video tag. See this answer for how to do that from JavaScript.

To play video in full-screen mode the WebView passes the URL to the Android media player and the file:///android_asset scheme is something only the WebView supports. If you're assigning an http(s) URL then you're fine and don't need to do anything else, otherwise I guess one way would be to unpack the video to your data folder and use a 'regular' file:// URL.

Community
  • 1
  • 1
marcin.kosiba
  • 3,221
  • 14
  • 19