You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Kees van den Broek (JIRA)" <ji...@apache.org> on 2014/06/05 11:06:01 UTC

[jira] [Created] (CB-6880) Add Media.MEDIA_READY state

Kees van den Broek created CB-6880:
--------------------------------------

             Summary: Add Media.MEDIA_READY state
                 Key: CB-6880
                 URL: https://issues.apache.org/jira/browse/CB-6880
             Project: Apache Cordova
          Issue Type: Improvement
          Components: Android
    Affects Versions: 3.5.0
         Environment: Android specifically, but applies to all platforms.
            Reporter: Kees van den Broek
            Priority: Minor


The way to call getDuration() by polling until ready is not optimal. This proposal might lead to more event-driven approach:

If I look at the code (src/android/AudioPlayer.java: loadAudioFile), I see:

 this.setState(STATE.MEDIA_STARTING);
 this.player.setOnPreparedListener(this);
 this.player.prepare();

 // Get duration
 this.duration = getDurationInSeconds();

When the duration is set, it would be useful to fire a state updated event to indicate the metadata is ready.
On call to getDuration() should be enough to get the information right away.



--
This message was sent by Atlassian JIRA
(v6.2#6252)