Cordova (android) launched a web server inside the device for video playback, but cannot play when offline

Asked 2 years ago, Updated 2 years ago, 156 views

I have a question about video playback.

[Purpose]

I want to play videos inside html using a video tag within the app created by Cordova.
Works with Android 5.0, but cannot play with WebView with Android 4.4.2.

[Problems]

The video can only be played up to 100 seconds.

[Library used, etc.]

[Background]


using the File API of the Cordova plug-in for video playback
/data/data/<app-id>/files/

I placed the file below, where I was playing the video, but I could only play it for 100 seconds.

Since video access was a file protocol, I started a web server inside Android using the cordova.httpd plug-in to access the video using the http protocol.
At the same time, the file protocol cannot access the http protocol, so I used the inappbrowser plug-in to launch a separate window and display HTML for video playback inside it.

 http://192.168.2.1:8080/sample/sample.html

can be accessed as .

Here's the question.
If the Android device is connected to wifi (online), all videos will be played.
If it is not connected to wifi, it can only be played up to 100 seconds like above.
Offline

 http://127.0.0.1:8080/sample/sample.html

access the .

You can use Chrome's adb extension to debug the connected Android Web View, so when I followed the log, the video file loading was displayed as (pending).

[Purpose] I wish I could achieve it, so I don't care how to do it, but is there any way to load the video or play the video?

android webview cordova video

2022-09-30 20:27

1 Answers

From questioner silvermotto's comment.

I was able to do this by starting another activity in Crosswalk and replacing inappbrowser.


2022-09-30 20:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.