fix: Increase reliability of media auto actions (e.g. play) (#1934)
Refactors media player handling entirely to make the code more consistent and less boilerplate. Add testing for media player actions. - Closes #1921 - Closes #1916
This commit is contained in:
@@ -4,6 +4,6 @@ import { AdvancedCameraCardAction } from './base';
|
||||
|
||||
export class MuteAction extends AdvancedCameraCardAction<GeneralActionConfig> {
|
||||
public async execute(api: CardActionsAPI): Promise<void> {
|
||||
await api.getMediaLoadedInfoManager().get()?.player?.mute();
|
||||
await api.getMediaLoadedInfoManager().get()?.mediaPlayerController?.mute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { AdvancedCameraCardAction } from './base';
|
||||
|
||||
export class PauseAction extends AdvancedCameraCardAction<GeneralActionConfig> {
|
||||
public async execute(api: CardActionsAPI): Promise<void> {
|
||||
await api.getMediaLoadedInfoManager().get()?.player?.pause();
|
||||
await api.getMediaLoadedInfoManager().get()?.mediaPlayerController?.pause();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { AdvancedCameraCardAction } from './base';
|
||||
|
||||
export class PlayAction extends AdvancedCameraCardAction<GeneralActionConfig> {
|
||||
public async execute(api: CardActionsAPI): Promise<void> {
|
||||
await api.getMediaLoadedInfoManager().get()?.player?.play();
|
||||
await api.getMediaLoadedInfoManager().get()?.mediaPlayerController?.play();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { AdvancedCameraCardAction } from './base';
|
||||
|
||||
export class UnmuteAction extends AdvancedCameraCardAction<GeneralActionConfig> {
|
||||
public async execute(api: CardActionsAPI): Promise<void> {
|
||||
await api.getMediaLoadedInfoManager().get()?.player?.unmute();
|
||||
await api.getMediaLoadedInfoManager().get()?.mediaPlayerController?.unmute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user