언어 설정

Menu
Sites
Language
In my App Sound is coming when mobile is in Silent Mode.

How to solved this problem when mobile is in Silent Mode App Sound is coming.

Responses

17 댓글
daniel kim

would be helpful to see your problem if you share more details about your application.

 

Palitsyna

Hello,

please, give more details or share your code. 

And just FYI, here you can find Sound API: https://developer.tizen.org/dev-guide/2.3.0/org.tizen.web.apireference/html/device_api/wearable/tizen/sound.html

and Sound Tutorial: https://developer.tizen.org/development/tutorials/web-application/tizen-features/multimedia/sound-0?langswitch=en

Maybe this will help you.

 

 

pius lee

I think you want change "MEDIA" volume on "MUTE" mode.

var sm = tizen.sound;
sm.setSoundModeChangeListener(function(type) {
	console.log("sound mode changed to [" + type+"]");
	
	// do some action to your app's sounds
	if (type === "MUTE") {
		console.log("muted!!!")
		sm.setVolume("MEDIA", 0);
		console.log("muted!!!");
	}
});

This code change media volume to zero on system muted.

"MEDIA" volume is sound that come from your application normaly.

Palitsyna

Hello,

you also need to add volume.set privilege to your congig.xml file to use setVolume() method:

<tizen:privilege name="http://tizen.org/privilege/volume.set"/>

pius lee

Oh, correct! I miss privilege. :(

ashish kumar

set all the privilege but doesn't work......

Palitsyna

I've checked this code: it gives an the error on the following line:

tizen.sound.setVolume("MEDIA", 0);

It says, that http://tizen.org/privilege/volume.set privilege is required, but I've already added it. I've tried to clean the workspace and to add this privilege again(in code editor and using privilege tab) but it still doesn't work. 
I'll post a message here if I find the answer.

ashish kumar

this code are not working.... how to use this?

pius lee

I have getting success with following source.

Add Privilege to config.xml

<tizen:privilege name="http://tizen.org/privilege/volume.set"/>

Do it after in window.onload. (I think it would not matter.)

var sm = tizen.sound;
sm.setSoundModeChangeListener(function(type) {
	// do some action to your app's sounds
	if (type === "MUTE") {
		sm.setVolume("MEDIA", 0);
		console.log("muted!!!");
	}
});

 

ashish kumar

hi pius lee

Nothing happen mobile is silent but application not in slient mode.

ashish kumar

This is a game application and sound also there. if my phone is in general mode then work fine....but problem is if phone is slient mode then i don't want any sound..

pius lee

I think my answer work on your app.

You know android also has indivisual media sound on system muted.

When Tizen device gone muted, every sound except "MEDIA" change to zero.

ashish kumar

Any one can reply fast ple....

ashish kumar

Is it possible using vibrate..

Seoghyun Kang

Sure. Please refer the following code.

if (typeof navigator.webkitVibrate === 'function') {
    navigator.webkitVibrate(100);
} else {
    navigator.vibrate(100);
}

 

ashish kumar

hi Anyone find the solutation of this type of problem.

ashish kumar

var mode = tizen.sound.getSoundMode();
alert(mode);
if (mode === "VIBRATE") {
    alert("welcome");
    var sm = tizen.sound;
    sm.setVolume("MEDIA", 0);
    console.log("muted!!!");
}
else
    {
    var vol = tizen.sound.getVolume("RINGTONE");
    tizen.sound.setVolume("RINGTONE", vol + 0.1);
    }

 

 

this code work fine....