Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15831] Android: Ti.Media.createSound "looping" set on creation fails

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-02-14T22:06:47.000+0000
Affected Version/sRelease 3.1.3
Fix Version/s2014 Sprint 03 API
ComponentsAndroid
Labelsandroid, createsound, looping, module_media, qe-closed-3.3.0, qe-testadded, sound
ReporterFokke Zandbergen
AssigneeBiju pm
Created2013-11-26T14:58:16.000+0000
Updated2014-06-20T10:39:11.000+0000

Description

On iOS this works fine:
var music = Ti.Media.createSound({
    url: 'music.aac',
    looping: true
});
music.play();
On Android you need to set looping after creation and in the tests I ran even right before calling play(), or the music will stop after one or some loops.
var music = Ti.Media.createSound({
    url: 'music.aac',
    looping: true
});
music.looping = true;
music.play();

Logs

When the playback on Android stops, the logs show:
09-10 21:35:16.422: I/ALSAModule(1838): Terminated ALSA PLAYBACK device hifi
09-10 21:35:16.812: I/yamaha::media::UserDep(1838): UserDep::getRouteInfo(output: audioengine=0, devices=00000002h
09-10 21:35:16.812: I/yamaha::media::UserDep(1838):                       incall: onoff=0, devices=00000000h
09-10 21:35:16.812: I/yamaha::media::UserDep(1838):                       capture: onoff=0, devices=00000000h, audioSource=0
09-10 21:35:16.812: I/yamaha::media::UserDep(1838):                       playback: audio_onoff=0, line_onoff=0)

Steps to reproduce

Create a new app: titanium create -p ios,android -n testLoop -d . --id test.loop

As app.js use:

    var w = Ti.UI.createWindow({backgroundColor:'white'});
    var b = Ti.UI.createButton({title:'Play'});
    var m = Ti.Media.createSound({
        url: 'music.aac',
        looping: true
    });
    b.addEventListener('click', function () {
        m.play();
    });
    w.add(b);
    w.open();
    

Drop the attached music.acc (CCL) in the Resources folder.

Run the app on both iOS and Android and see the music stop on Android after one or some loops.

Attachments

FileDateSize
music.aac2013-11-26T14:58:17.000+0000121214

Comments

  1. Biju pm 2013-11-27

    PR : - https://github.com/appcelerator/titanium_mobile/pull/5036
  2. Priya Agarwal 2014-06-20

    Verified with environment: Appcelerator-Studio:3.3.0.201406171619 Sdk:3.3.0.v20140619164112 acs:1.0.14 alloy:1.4.0-rc npm:1.3.2 titanium:3.3.0-rc titanium-code-processor:1.1.1 xcode:5.1.1 OS:Maverick(10.9.3) Device:iPhone5s(v7.1.1),Nexus4(v4.1.1)

JSON Source