We have problems with an audio reader hybrid application, using fairly large audio m4a files. In short, it takes far too long to start the playback (when using online audio resources).
To illustrate the issue, we've created a smaller prototype with the following structure:
Body:
<audio src="..." controls="controls" preload="none"></audio>
<button class="change-current-time">Play and change currentTime</button>
Script:
var audioTags = document.querySelectorAll('audio');
[].forEach.call(audioTags, function (item) {
item.addEventListener('play', onPlayStateChange);
item.addEventListener('timeupdate', onPlayStateChange);
item.addEventListener('error', onPlayStateChange);
item.addEventListener('pause', onPauseReset);
});
function onPlayStateChange(e) {
var id = e.target.parentNode.id;
if (count[id]) {
return;
}
if (e.type === 'play') {
count[id + 'start'] = +new Date();
} else if (e.target.parentNode.querySelector('audio').currentTime > currentTimeOffset) {
var span = e.target.parentNode.querySelector('span');
count[id] = 1;
if (span) {
span.innerText = e.type === 'error' ? 'Audio type or codec does not supported' : new Date() - count[id + 'start'];
}
}
}
There is the full example.
When we build the app with Cordova 6.4.0 using WebView, it starts playback in ~3.5s. The network activity looks like this:
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=webview HTTP/1.1 206 29522945
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=webview HTTP/1.1 206 326657
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=webview HTTP/1.1 206 29163520
When we build the app with Cordova 6.4.0 with Crosswalk-webview plugin 2.2.0, it starts playback in 18s at best, but sometimes the delay is even more substantial - up to 45s. It seems the main reason is the difference in the network activity:
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 206 2
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 200 29522945
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 206 577690
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 200 29522945
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 206 577690
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 200 29522945
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 206 577690
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 200 29522945
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 206 577690
GET /tmp/1916firstchapterscollection_09_various_64kb.m4a?app=crosswalk HTTP/1.1 206 7384995
... when only the first request is served with the 'normal' user-agent, all the subsequent ones are served with stagefright/1.2 (Linux;Android 5.0.1)
.
Why's the difference, and how can we avoid this?
P.S. Here's the folder with all the apks and related data.
If found any bug related to crosswalk plugin you can submit it on if not submitted yet https://crosswalk-project.org/jira/plugins/servlet/mobile#login/ Crosswalk project site, usualy they take imidiate action and resolve it. If you got it resolved please update answer here.
UPDATE
I found your(maybe yours) issue: https://crosswalk-project.org/jira/plugins/servlet/mobile#issue/XWALK-7484
Developers having same question track the issue on this link .. ATB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With