blackberry / WebWorks-Community-APIs

Community owned repository containing JavaScript Extensions for BlackBerry WebWorks
Apache License 2.0
140 stars 204 forks source link

LowLatencyAudio issue when using bluetooth earphone #338

Closed MerrickZ closed 9 years ago

MerrickZ commented 10 years ago

as reported by 2048 user, if I use preload to load the wave files into memory, the bluetooth earphone start to work. no matter I play a sound or not.

could this be fixed so when people don't want to drain their batteries?

t470520 commented 10 years ago

@anphorea can you provide a sample work space?

MerrickZ commented 10 years ago

@t470520 That's simple. just call preloadAudio(data, path, voices, success, fail) {}, and don't do anything else, it would open the bluetooth earphone, as reported.

here's the sample project www folder. https://app.box.com/s/jr20j12zkidm3s7b1v7p

  1. create a sample project
  2. add com.blackberry.community.lowlatencyaudio plugin
  3. overwrite the www folder with files above
  4. run it.

Plus , @timwindsor could you please do some rename on this plugin? when add it, it's all lowercase letters, but when view ( weborks plugins ), it's LowLatencyAudio, this makes me mad ;)

Thank you

t470520 commented 10 years ago

@anphorea Thanks for the tips. But I don't have the access to the sample project that you provide. Can you add my Email to the access list?

timwindsor commented 10 years ago

@anphorea It's named that way because they are trying to match the plugin for iOS and Android, as we wanted to make it work well cross platform. We've tried to be consistent with our own plugins, but these ones that we try to match with sometimes have wildly different naming schemes and architecture.

t470520 commented 9 years ago

@anphorea I ran a few tests and found out that not just preloadAudio turns on the audio device but all other functions(unload, play, stop, getDuration, and loop). Unless I kill the sample app, otherwise the white noise would not go away.

MerrickZ commented 9 years ago

‎So, any idea about how to fix this and save the power?  发送自我的 BlackBerry 10 智能手机。

t470520 commented 9 years ago

I am trying to use a timer to check if any function is call after a wav file is preloaded. If not then call the destructor to free it, otherwise let it stay for further usage.

t470520 commented 9 years ago

update complete, pull request sent. Waiting for update review.

t470520 commented 9 years ago

complete with #352.

timwindsor commented 9 years ago

@anphorea Give it a shot when you have a chance and make sure it's working for you. Thanks