7

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.

Alex
  • 79
  • 2
  • Creating something lika a [Github](https://github.com/) repository for your prototype would make it a lot easier to reproduce your problem. – Phonolog Jan 21 '17 at 17:16
  • @Alex I guess you have already raised an issue in crosswalk project and it has been triaged as a P2 issue. So we may have to wait for the fix from crosswalk team. Have posted it for the benefit of others – Gandhi Jan 25 '17 at 04:50
  • you are not alone.... [similar question on xda](https://forum.xda-developers.com/android/help/stagefright-makes-multiple-http-t3390372) and even on [github](https://github.com/WhisperSystems/Signal-Android/issues/4636) – ymz Jan 25 '17 at 21:21

1 Answers1

1

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

Rohit Dhiman
  • 2,691
  • 18
  • 33