paleRider Posted April 1, 2018 Share Posted April 1, 2018 Hi there: I have a BJS development in production that works great in all platform but iOS-Cordova app. In this last configuration the sound doesn't work at all, dumping the following error message: Any clues on this? Thanks for your time. Quote Link to comment Share on other sites More sharing options...
PsichiX Posted April 1, 2018 Share Posted April 1, 2018 show us code that loads this audio file. paleRider 1 Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 1, 2018 Author Share Posted April 1, 2018 Hi PsichiX: Tomorrow in the morning (CET) I'll be back in the office, able to show that (very simple) lines of code. Anytime please consider that the code is working flawless in browsers (Win, macOS and Linux) and Android Cordova hybrid app, and only failing in iOS Cordova hybrid app. Thanks for your time. Best regards. Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 2, 2018 Author Share Posted April 2, 2018 Well, my (really-simple) sound related code lines are these: var _Sfx=new BABYLON.Sound("sfx","assets/sounds/sfx.mp3",_Scene,null,{ autoplay: false, loop: true, volume: 0} ); ... function _updateVolume(param){ ... // _Sfx.setVolume(param); } As said, it works on: desktop - Windows - web - FF desktop - Windows - web - Chrome desktop - macOSX - web - Safari mobile - Android - web - Chrome mobile - Android - hybrid app (Cordova) mobile - iOS - web - Safari But not in mobile - iOS - hybrid app (Cordova). Best regards. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 2, 2018 Share Posted April 2, 2018 probably the same reason as here: Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 2, 2018 Author Share Posted April 2, 2018 Hi Deltakosh: I supposed that but the console logs are quite different. Anyway, I'll try the way-of-the-blob also here and let you know. Thank you. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 3, 2018 Share Posted April 3, 2018 One thing I am pretty sure works is converting to inline Javascript with a Base64 encoded audio buffer. The decoding in the Javascript is very minor, but built into the QI extension to reduce amount of code generated. I have a page which will either record off mic or bring in files for conversion. When using the mp3 decoder to bring in files, they will be sampled at the highest rate your desktop hardware supports, even if lower in the actual .mp3 file. You can down sample when writing script to reverse this. You would no longer be at the mercy of the platform. At times that can be a very good idea. paleRider 1 Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 3, 2018 Author Share Posted April 3, 2018 Hi JCPalmer: Well, as Deltakosh wrote this is a problem related with the way Cordova-iOS manages the local storage XHR resources. Anyway, when I use a web-served URI, the error is gone (so I suppose the mp3 is loaded) but sadly no sound is produced. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 3, 2018 Share Posted April 3, 2018 This sounds like Bug territory. maybe see https://forum.ionicframework.com/t/ios-9-2-cordova-plugin-media-no-sound-fix-on-the-way/45100 Edit: Never mind, bug was fixed paleRider 1 Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 3, 2018 Author Share Posted April 3, 2018 Thanks JC: Yes, I suppose I need to start looking for this issue in JQM/Ionic/Cordova forums. With iOS you always know it's going to be painful. Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 3, 2018 Author Share Posted April 3, 2018 Well, this is embarrasing... the case is that my problem with remote served mp3 not "sounding" was only due to the infamous Side Switch. It was turned off. The confusing thing was that movies and music were played w/o problem (?) and so I didn't realized it was off. Quote Link to comment Share on other sites More sharing options...
paleRider Posted April 4, 2018 Author Share Posted April 4, 2018 Well, only as a epilogue for this (already closed) issue, I finally managed to have my DDS local file working on iOS. Please see related thread: ...with the help of cordova-plugin-wkwebview-file-xhr. Sadly, against the expected, that is not the same with the other XHR-loaded asset of my app, the MP3 local file, so I get the following Xcode error output on it: 2018-04-04 16:43:53.758536+0200 ERROR: BJS - [16:43:53]: error on XHR request. 2018-04-04 16:43:53.760983+0200 xhr-polyfill.js - exception delivering event {"isTrusted":false} TypeError: Argument 1 ('audioData') to webkitAudioContext.decodeAudioData must be an instance of ArrayBuffer Oracle's guys says me that it's because "...the babylon code is not setting the XMLHttpRequest responseType to "arraybuffer". The polyfill with this plugin only has a small list of file suffixes to default response types. The native XMLHttpRequest probably defaults "arraybuffer" based on the URL suffix but we are defaulting to text." Quote Link to comment Share on other sites More sharing options...
Guest Posted April 4, 2018 Share Posted April 4, 2018 Weird...because we ARE actually setting the responseType to arrayBuffer: https://github.com/BabylonJS/Babylon.js/blob/c224954e1b2005f1d01fa711904075e0129a208e/src/Tools/babylon.tools.ts#L604 paleRider 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.