apache / apache/cordova-android
Videos are not seekable (WebViewAssetLoader needs to support range requests)
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 1.6k
- Avg merge
- 16h 18m
- Merged PRs (30d)
- 11
Description
# Bug Report
## Problem
Videos in cordova-android are not seekable, apparently since the introduction of WebViewAssetLoader in v10.
Sample Cordova project:
[TestVideo.zip](https://github.com/apache/cordova-android/files/9607469/TestVideo.zip)
When built and run on a device, touch the red circle to play a video. Touch the orange bar to seek to 10 seconds (this sets `currentTime` on the HTMLVideoElement).
### What is expected to happen?
Video to seek to 10 second point in video.
### What does actually happen?
Video restarts.
## Information
I believe the problem is that WebViewAssetLoader returns 200 OK for all responses.
However Chrome can't allow media elements to be seekable unless the "server" supports range requests. This is of course designed to work over the network, but even though the resources are all local, it still must correctly handle range requests in order to allow media to be seekable. So I think if WebViewAssetLoader serves range requests as expected it will fix this problem.
I'm not sure if the API is the same but this fix from the Ionic team looks relevant: https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/298
### Command or Code
Build and run provided Cordova project on an Android device.
### Environment, Platform, Device
Tested on Asus ZenFone 8 with Android 12. Also reported to happen on Samsung S5e Tablet (see https://github.com/Scirra/Construct-3-bugs/issues/6122).
### Version information
Cordova Android v11.0.0
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Build and run the provided TestVideo.zip project on an Android device, then inspect WebViewAssetLoader response handling for video requests. Compare the current behavior with the linked Ionic fix and verify completion by confirming that seeking the video to 10 seconds works instead of restarting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100