BuddyLReno commented on issue #197: Add durationUpdate callback
URL: 
https://github.com/apache/cordova-plugin-media/pull/197#issuecomment-439426503
 
 
   Yes, I can elaborate.
   
   In the newer versions of android, after about five minutes of background 
activity, android shuts down the web container that is running the app. So when 
you try to use a background task to query for the duration with a `setTimeout` 
as is described in the docs, that setTimeout never actually runs.  This occurs 
even if you use a plugin like cordova-plugin-background-mode.
   
   What I mean by subscribing, is basically just attaching a callback to allow 
the native code to run the callback when the audio player assigns duration. By 
doing this, you always get a real duration and don't have to worry about 
getting a "-1" duration as it only reports the duration after the audio player 
actually initializes and has the real duration. This removes the need to query 
for duration with a setTimeout, which prevents the situation above from 
happening. 
   
   Does that help?
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to