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

0 favourites
  • 2 posts
From the Asset Store
A futuristic device, can be used as radarscreen, optionscreen, infodisplay, research device, ...
  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    [attachment=0:3a3k6fdi][/attachment:3a3k6fdi]

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

    // Create new runtime using the c2canvas
    			cr_createRuntime("c2canvas");
    
    //put a code right here in your index.html
    
    });
    
    //CODE
    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;  
    		  }
    		}
    
    		[/code:3a3k6fdi]
    
    That code was written not by me and i can't explain it  throughly.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)