breautek commented on issue #295:
URL: 
https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-718115563


   > It's kind of a bug, no?
   
   I don't think this is a bug. If it was, you should follow the bug form 
provided when you create the issue.
   
   But the reason why I don't think this is a bug is users expect that volume 
is controlled via the hardware buttons of the device, or through the OS audio 
volume interface (where for example, android has several different audio 
streams that the user can control each one independently). Generally speaking 
of course. In my experience, in-app volume controls are always relative to the 
OS/hardware volume configuration. In my opinion, apps that break this rule are 
incredibly annoying.
   
   > Imagine a 5 second ringtone and someone lowers the "MEDIA" channel while 
the ringtone is playing.
   
   I'd expect the media channel volume will stay at the volume that I set it to 
until I change it otherwise.
   
   In other words, picture these scenarios:
   
   OS Volume 100%
   App Volume 100%
   App produces audio at its loudest setting
   
   OS Volume 100%
   App Volume 0%
   App produces no audio, however other apps may still produce audio.
   
   OS Volume 0%
   App Volume 100%
   App produces no volume because 100% of 0 is 0. And this is probably want the 
user wants if they have their OS volume setting to 0%.
   
   This follows the effective media volume as defined in the [W3C Living 
Specification](https://html.spec.whatwg.org/multipage/media.html#effective-media-volume).
   
   Specifically:
   >Return volume, interpreted relative to the range 0.0 to 1.0, with 0.0 being 
silent, and 1.0 being the loudest setting, values in between increasing in 
loudness. The range need not be linear. The loudest setting may be lower than 
the system's loudest possible setting; for example the user could have set a 
maximum volume. 
   
   Cordova aims to bring a consistent web technologies stack in the form of 
hybrid apps. So providing APIs that breaks a defined specification is generally 
outside of Apache's scope. But Android does have APIs through the 
[AudioManager](https://developer.android.com/reference/android/media/AudioManager)
 class to forcefully change each audio stream volume, which sounds like what 
you want. I'm not familiar with iOS SDK at all so I can only assume iOS has an 
equivalent API. Research would be required if you intend to support iOS. 
   
   I would encourage you to rethink about volume control in your app, and if 
you decide that forcefully controlling the OS volume is necessary for your app, 
then you are right. This plugin won't be sufficient for your use case, and 
you'll either find a more robust plugin that uses the advanced APIs provided by 
the platform SDKs or roll your own plugin that does so.
   
   Hope this helps you understand the reason why the volume behaves the way it 
does and potential solutions to your specific use case.


----------------------------------------------------------------
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