Is there a way to detect if a device can't play audio?

Get help using Construct 2

Post » Tue Feb 24, 2015 7:06 pm

Is it possible to check if the device your app is running on can't play music, so that I can then remove any icons associated to that?
Some games: ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
Posts: 155
Reputation: 1,619

Post » Tue Mar 17, 2015 9:32 am

Sometimes, we need to remove sound from the problem devices like galaxy s3, sharp, xperia Z , and hide audio button on them.
I found a solution for that.
First, we need to add an events and global variable to a project:

Then, we need to export the game and add a code to the index.html

Code: Select all
// Create new runtime using the c2canvas

//put a code right here in your index.html


var ua = navigator.userAgent.toLowerCase();
      var isSthree = ((/gt-i9300|gt-i9305|gt-i9301|sgh-n064|sgh-n035|sch-j021|sgh-t999l/i).test(ua));
      var isSharp = ((/SHL24|SHL23|SHL22|SHL25|SHL21/i).test(ua)) && !/(firefox|opera|chrome)/i.test(ua);
      var isXperia = ((/D6603|D6616|D6633|D6643|D6653|L55t|L55u|D6708/i).test(ua)) && !/(firefox|opera|chrome)/i.test(ua);
      var isXperiaZ = ((/C6602|C6603|C6606|C6616|SO-02E/i).test(ua)) && !/(firefox|opera|chrome)/i.test(ua);
      var isIE10 = /MSIE 10/i.test(navigator.userAgent);
      var isTest = false;
      // var isTest = false;
      delete sessionStorage.rm_disablesound;

      if (typeof (Storage) !== "undefined")
        if(isSthree || isSharp || isIE10 || isTest || isXperia || isXperiaZ)
         sessionStorage.rm_disablesound = 1; 


That code was written not by me and i can't explain it throughly.
You do not have the required permissions to view the files attached to this post.
Posts: 9
Reputation: 570

Return to How do I....?

Who is online

Users browsing this forum: bambo, bluehatpixel, Ryogo and 2 guests