mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
volume/mute handled in chromecast transport
This commit is contained in:
parent
d770b5572a
commit
817dcbd3cc
1 changed files with 38 additions and 0 deletions
|
|
@ -209,6 +209,28 @@ function ChromecastTransport() {
|
|||
cast.framework.CastContext.getInstance().endCurrentSession(action.stopCasting);
|
||||
return;
|
||||
}
|
||||
case 'setVolume': {
|
||||
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (castSession) {
|
||||
castSession.setVolume(MESSAGE_NAMESPACE, action.volume)
|
||||
.catch((code) => {
|
||||
onCastError(code);
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case 'setMute': {
|
||||
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (castSession) {
|
||||
castSession.setMute(MESSAGE_NAMESPACE, action.muted)
|
||||
.catch((code) => {
|
||||
onCastError(code);
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case 'message': {
|
||||
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (castSession) {
|
||||
|
|
@ -234,6 +256,22 @@ function ChromecastTransport() {
|
|||
return session.getCastDevice();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
this.getVolume = function() {
|
||||
const session = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (session !== null) {
|
||||
return session.getVolume();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
this.isMute = function() {
|
||||
const session = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (session !== null) {
|
||||
return session.isMute();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue