You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After trying to fix issue #205 someone introduced an even bigger bug, that broke the video player sporadically.
This was very hard to debug since it doesn't always manifest.
available does not always return the size of the file (at least on android 27), result of a content-Range smaller the the reality and stopping the video in the middle.
This is not the only problem, when a Range is specified that client would expect to receive only the requested part, but in this case the InputStream is returned in full, a fix would be to create a wrapping stream that skip on initialization/reset and return -1 once the end is reached (if the end is specified).
For now, I have the following script that patches the code by dropping support for large requests, clearly not ideal.
afterPrepare.js:
const fs = require('fs');
const path = require('path');
module.exports = function(ctx) {
// Make sure android platform is part of build
if (!ctx.opts.platforms.includes('android')) return;
const platformRoot = path.join(ctx.opts.projectRoot, 'platforms/android');
// disable range requests
const webViewLocalServerFile = path.join(platformRoot, 'app/src/main/java/com/ionicframework/cordova/webview/WebViewLocalServer.java');
const webViewLocalServerContent = fs.readFileSync(webViewLocalServerFile, 'utf-8');
const webViewLocalServerContentEdited = webViewLocalServerContent.replace('request.getRequestHeaders().get("Range") != null)', 'request.getRequestHeaders().get("Range") != null && false) /* disabling range because of bug: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/632 */');
fs.writeFileSync(webViewLocalServerFile, webViewLocalServerContentEdited, 'utf-8');
};
The text was updated successfully, but these errors were encountered:
yelhouti
changed the title
Range requests returning corrupted information
Range requests returning corrupt information
Dec 20, 2020
After trying to fix issue #205 someone introduced an even bigger bug, that broke the video player sporadically.
This was very hard to debug since it doesn't always manifest.
cordova-plugin-ionic-webview/src/android/com/ionicframework/cordova/webview/WebViewLocalServer.java
Line 251 in ab7dfc0
available does not always return the size of the file (at least on android 27), result of a content-Range smaller the the reality and stopping the video in the middle.
This is not the only problem, when a Range is specified that client would expect to receive only the requested part, but in this case the InputStream is returned in full, a fix would be to create a wrapping stream that skip on initialization/reset and return -1 once the end is reached (if the end is specified).
For now, I have the following script that patches the code by dropping support for large requests, clearly not ideal.
afterPrepare.js:
The text was updated successfully, but these errors were encountered: