Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2135] iOS: Audioplayer change state inconsistencies

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2012-01-03T15:13:10.000+0000
Affected Version/sRelease 1.5.0
Fix Version/sSprint 2011-45, Release 1.8.0
ComponentsiOS
Labelsmodule_media, qe-testadded, regression
Reportertcbb
AssigneeReggie Seagraves
Created2011-04-15T03:11:29.000+0000
Updated2013-12-10T06:07:49.000+0000

Description

Hi,

I'm currently finding that when I create an event listener that listens to the audioPlayer change state, the state reported varies widely across platforms and even devices.

Take the following code for instance (no affiliation with the URL, just for example purposes:)


Ti.API.log("Audio Stream App Started");
 
var url ='http://www.parishiltonjustme.com/downloads/audio/08_Screwed.mp3';
 
var streamer1 = Ti.Media.createAudioPlayer();
 
streamer1.addEventListener('change',function(e)
{ 
    Ti.API.log("AudioPlayer addEventListener 'change' says : "+e.description);
});
 
streamer1.url = url;
 
streamer1.start();

When this runs, i get several different results depending on device OS and even device vs. emulator.(see below)

In some instances,there is no report of a stopping or stopped state. Considering this, for instance, how might one go about creating a music stream player that auto-advances on all devices in Titanium Mobile?

I first tried the developer support forum on this one a couple weeks back, although no responses there.

http://developer.appcelerator.com/question/68291/audioplayer-change-state-inconsistencies"> http://developer.appcelerator.com/question/68291/audioplayer-change...

Thanks,
Darin

iPhone 4.1 Emulator

[INFO] Audio Stream App Started
[INFO] AudioPlayer addEventListener 'change' says : waiting_for_data
[INFO] AudioPlayer addEventListener 'change' says : waiting_for_data
[INFO] AudioPlayer addEventListener 'change' says : waiting_for_queue
[INFO] AudioPlayer addEventListener 'change' says : playing
[INFO] AudioPlayer addEventListener 'change' says : stopping
[INFO] AudioPlayer addEventListener 'change' says : stopped
[INFO] AudioPlayer addEventListener 'change' says : initialized
Android 1.6 Emulator
[INFO] Audio Stream App Started
[INFO] AudioPlayer addEventListener 'change' says : starting
[INFO] AudioPlayer addEventListener 'change' says : initialized
[INFO] AudioPlayer addEventListener 'change' says : playing
[INFO] AudioPlayer addEventListener 'change' says : playing
^never reports stopping or stopped^

Andriod 2.2 Emulator

[INFO] Audio Stream App Started
[INFO] AudioPlayer addEventListener 'change' says : starting
[INFO] AudioPlayer addEventListener 'change' says : initialized
[INFO] AudioPlayer addEventListener 'change' says : playing
[INFO] AudioPlayer addEventListener 'change' says : playing
[INFO] AudioPlayer addEventListener 'change' says : stopping
[INFO] AudioPlayer addEventListener 'change' says : stopped
Android 2.2 T- Mobile G2 (ADB logcat)
I/TiAPI   ( 4260): (kroll$3) [22,25] [Audio Stream App Started] null
I/TiAPI   ( 4260): (kroll$3) [2207,2232] [AudioPlayer addEventListener 'change' says : starting] null
I/TiAPI   ( 4260): (kroll$3) [33,2265] [AudioPlayer addEventListener 'change' says : initialized] null
I/TiAPI   ( 4260): (kroll$3) [4,2269] [AudioPlayer addEventListener 'change' says : playing] null
I/TiAPI   ( 4260): (kroll$3) [2,2271] [AudioPlayer addEventListener 'change' says : playing] null
^never reports stopping or stopped^

Attachments

FileDateSize
testing.zip2011-04-15T03:11:30.000+0000143684

Comments

  1. turl 2011-04-15

    I'm having this problem too; more specifically, stopping/stopped doesn't fire on any Android 2.1 that I tried (both emulator and a real device). playing/initializing/etc all work fine.

    This is a blocker for my app, I can't build a good media player with a playlist if I don't know when a song stops playing :(

    For now, I'm using a function being run at intervals that checks the playing and waiting properties, but this isn't a real solution to this issue.

  2. Eli Mor 2011-04-15

    I'm having this problem as well. Seems to be related to the 1.5.x branch, tested 1.5, 1.5.1 and the 1.5.2 build from Dec 27 2010 12:47 r9a159e76 - The change event does not work. Tested it on the Audioplayer version of Kitchen sink. Attached the project.
    Tested the same on project on 1.4.2 and the latest master: Dec 28 2010 21:19 r9157d0d9 and it works.

  3. Eli Mor 2011-04-15

    Not sure why this is not getting any attention. The player state does not change. Can anyone at least confirm whether this is a real bug or not?

    tagged:"1.5.x" tagged:state tagged:audio

  4. Pat Edison 2011-04-15

    I'm still waiting for somebody to tell me if I am dreaming or not on this one. It's kind of killed my development of a radio station app, at least under 1.5.1 when building for the iPhone.

    I can build OK under Appcelerator SDK 1.4x but because of another bug whereby my app seems not to want to run under iOS3.1 I was hoping that the latest of everything would be 'the fix'.

    I use the 'change' event to monitor the stream so the stop/start button can change it's icon in response to the actual stream, also to supply a user with some text as to what's going on - i.e. "Buffering", "Stopping" etc.

  5. Rick Blalock 2011-04-15

    I've verified that the change event does not work in 1.5.1 as well. Re: http://developer.appcelerator.com/helpdesk/view/62371">http://developer.appcelerator.com/helpdesk/view/62371

    The audio change event works in 1.6.

  6. talldude 2011-04-15

    Audio Events do not appear to be working in 1.6 either - I've done multiple clean builds on the latest daily snapshots, and it's not working:

    http://developer.appcelerator.com/helpdesk/view/62371">http://developer.appcelerator.com/helpdesk/view/62371

    I just got done testing the latest build here:

    http://builds.appcelerator.com.s3.amazonaws.com/index.html">http://builds.appcelerator.com.s3.amazonaws.com/index.html

    (Jan 21 2011 19:11 rfcfcc850)

    and events are not working for me.

  7. Jordy 2011-04-15

    @talldude: it is working for me with this build: "Jan 21 2011 19:11 rfcfcc850" on http://builds.appcelerator.com.s3.amazonaws.com/index.html">http://builds.appcelerator.com.s3.amazonaws.com/index.html

  8. Reggie Seagraves 2011-11-07

    Fixed in a previous checkin.
  9. Eric Merriman 2011-12-06

    Verified fixed with SDK 1.8.0.1.v20111205164258 on iPad 2 (4.3.5), iPhone 4s (5.01), iPod touch 3rd gen (4.0.2). All devices report as in Reggie's comments above.
  10. Michael Pettiford 2012-01-03

    Reopening/Closing to update labels
  11. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5021

JSON Source