SmallhillCZ opened a new issue #302:
URL: https://github.com/apache/cordova-plugin-media/issues/302


   # Feature Request
   
   ## Motivation Behind Feature
   When webview restarts, e.g. due to battery saving feature when app is in 
background, it could access previously started sound -and control it.
   
   Also when developing in live reload the link to file is lost.
   
   ## Feature Description
   I play a long MP3, UUID is generated for the MP3 and status update callbacks 
are connected to the app. I turn off the screen and put my phone away. The 
sound keeps playing.
   
   After five minutes I unlock the screen, but the webview was killed to save 
battery and now has reloaded. Unfortunately it can no more acquire the pointer 
to the MP3 file, thus it cannot control its playing and it plays on its own now 
and status updates are not transmitted to the app.
   
   If I was able to specify a fixed ID instead of UUID, I could reacquire the 
handle, because internally existing Media object is returned if exists both for 
Android and iOS.
   
   **The code change would be easy**: To allow custom id assignment in this 
function, e.g. to pass `[id,src]` instead of `src` and use that `id`. Will be 
happy to send a PR if you agree to implement.
   
https://github.com/apache/cordova-plugin-media/blob/eb99c859ee8f5743c36a4355f4a71d43ce146444/www/Media.js#L42-L53
   
   ## Alternatives or Workarounds
   It would be also interesting to be able to list currently created 
mediaObject handles (e.g. implement Media.list() in Android in addition to 
Media.get() and implement it in JS API similarily). Then I could loop through 
all and search for Media with the same src. Or I could stop all playing playing 
sounds on e.g. leaving the current page.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to