Merge pull request #1112 from thecodingmachine/ios_phaser_sounds
Attempt to switch bubble sound playing into Phaser
This commit is contained in:
commit
1527134eeb
6
front/dist/index.tmpl.html
vendored
6
front/dist/index.tmpl.html
vendored
@ -91,12 +91,6 @@
|
|||||||
|
|
||||||
<div id="activeScreenSharing" class="active-screen-sharing active">
|
<div id="activeScreenSharing" class="active-screen-sharing active">
|
||||||
</div>
|
</div>
|
||||||
<audio id="audio-webrtc-in">
|
|
||||||
<source src="/resources/objects/webrtc-in.mp3" type="audio/mp3">
|
|
||||||
</audio>
|
|
||||||
<audio id="audio-webrtc-out">
|
|
||||||
<source src="/resources/objects/webrtc-out.mp3" type="audio/mp3">
|
|
||||||
</audio>
|
|
||||||
<audio id="report-message">
|
<audio id="report-message">
|
||||||
<source src="/resources/objects/report-message.mp3" type="audio/mp3">
|
<source src="/resources/objects/report-message.mp3" type="audio/mp3">
|
||||||
</audio>
|
</audio>
|
||||||
|
@ -44,7 +44,13 @@ export class TypeMessageExt implements TypeMessageInterface{
|
|||||||
mainSectionDiv.appendChild(div);
|
mainSectionDiv.appendChild(div);
|
||||||
|
|
||||||
const reportMessageAudio = HtmlUtils.getElementByIdOrFail<HTMLAudioElement>('report-message');
|
const reportMessageAudio = HtmlUtils.getElementByIdOrFail<HTMLAudioElement>('report-message');
|
||||||
reportMessageAudio.play();
|
// FIXME: this will fail on iOS
|
||||||
|
// We should move the sound playing into the GameScene and listen to the event of a report using a store
|
||||||
|
try {
|
||||||
|
reportMessageAudio.play();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
this.nbSecond = this.maxNbSecond;
|
this.nbSecond = this.maxNbSecond;
|
||||||
setTimeout((c) => {
|
setTimeout((c) => {
|
||||||
|
@ -160,6 +160,7 @@ export class GameScene extends DirtyScene implements CenterListener {
|
|||||||
private createPromise: Promise<void>;
|
private createPromise: Promise<void>;
|
||||||
private createPromiseResolve!: (value?: void | PromiseLike<void>) => void;
|
private createPromiseResolve!: (value?: void | PromiseLike<void>) => void;
|
||||||
private iframeSubscriptionList! : Array<Subscription>;
|
private iframeSubscriptionList! : Array<Subscription>;
|
||||||
|
private peerStoreUnsubscribe!: () => void;
|
||||||
MapUrlFile: string;
|
MapUrlFile: string;
|
||||||
RoomId: string;
|
RoomId: string;
|
||||||
instance: string;
|
instance: string;
|
||||||
@ -228,6 +229,11 @@ export class GameScene extends DirtyScene implements CenterListener {
|
|||||||
this.load.image(joystickBaseKey, joystickBaseImg);
|
this.load.image(joystickBaseKey, joystickBaseImg);
|
||||||
this.load.image(joystickThumbKey, joystickThumbImg);
|
this.load.image(joystickThumbKey, joystickThumbImg);
|
||||||
}
|
}
|
||||||
|
this.load.audio('audio-webrtc-in', '/resources/objects/webrtc-in.mp3');
|
||||||
|
this.load.audio('audio-webrtc-out', '/resources/objects/webrtc-out.mp3');
|
||||||
|
//this.load.audio('audio-report-message', '/resources/objects/report-message.mp3');
|
||||||
|
this.sound.pauseOnBlur = false;
|
||||||
|
|
||||||
this.load.on(FILE_LOAD_ERROR, (file: {src: string}) => {
|
this.load.on(FILE_LOAD_ERROR, (file: {src: string}) => {
|
||||||
// If we happen to be in HTTP and we are trying to load a URL in HTTPS only... (this happens only in dev environments)
|
// If we happen to be in HTTP and we are trying to load a URL in HTTPS only... (this happens only in dev environments)
|
||||||
if (window.location.protocol === 'http:' && file.src === this.MapUrlFile && file.src.startsWith('http:') && this.originalMapUrl === undefined) {
|
if (window.location.protocol === 'http:' && file.src === this.MapUrlFile && file.src.startsWith('http:') && this.originalMapUrl === undefined) {
|
||||||
@ -519,6 +525,21 @@ export class GameScene extends DirtyScene implements CenterListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.emoteManager = new EmoteManager(this);
|
this.emoteManager = new EmoteManager(this);
|
||||||
|
|
||||||
|
let oldPeerNumber = 0;
|
||||||
|
this.peerStoreUnsubscribe = peerStore.subscribe((peers) => {
|
||||||
|
const newPeerNumber = peers.size;
|
||||||
|
if (newPeerNumber > oldPeerNumber) {
|
||||||
|
this.sound.play('audio-webrtc-in', {
|
||||||
|
volume: 0.2
|
||||||
|
});
|
||||||
|
} else if (newPeerNumber < oldPeerNumber) {
|
||||||
|
this.sound.play('audio-webrtc-out', {
|
||||||
|
volume: 0.2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
oldPeerNumber = newPeerNumber;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -960,6 +981,7 @@ ${escapedMessage}
|
|||||||
this.userInputManager.destroy();
|
this.userInputManager.destroy();
|
||||||
this.pinchManager?.destroy();
|
this.pinchManager?.destroy();
|
||||||
this.emoteManager.destroy();
|
this.emoteManager.destroy();
|
||||||
|
this.peerStoreUnsubscribe();
|
||||||
|
|
||||||
mediaManager.hideGameOverlay();
|
mediaManager.hideGameOverlay();
|
||||||
|
|
||||||
|
@ -23,10 +23,8 @@ export type HelpCameraSettingsCallBack = () => void;
|
|||||||
|
|
||||||
export class MediaManager {
|
export class MediaManager {
|
||||||
private remoteVideo: Map<string, HTMLVideoElement> = new Map<string, HTMLVideoElement>();
|
private remoteVideo: Map<string, HTMLVideoElement> = new Map<string, HTMLVideoElement>();
|
||||||
webrtcInAudio: HTMLAudioElement;
|
|
||||||
//FIX ME SOUNDMETER: check stalability of sound meter calculation
|
//FIX ME SOUNDMETER: check stalability of sound meter calculation
|
||||||
//mySoundMeterElement: HTMLDivElement;
|
//mySoundMeterElement: HTMLDivElement;
|
||||||
private webrtcOutAudio: HTMLAudioElement;
|
|
||||||
startScreenSharingCallBacks : Set<StartScreenSharingCallback> = new Set<StartScreenSharingCallback>();
|
startScreenSharingCallBacks : Set<StartScreenSharingCallback> = new Set<StartScreenSharingCallback>();
|
||||||
stopScreenSharingCallBacks : Set<StopScreenSharingCallback> = new Set<StopScreenSharingCallback>();
|
stopScreenSharingCallBacks : Set<StopScreenSharingCallback> = new Set<StopScreenSharingCallback>();
|
||||||
showReportModalCallBacks : Set<ShowReportCallBack> = new Set<ShowReportCallBack>();
|
showReportModalCallBacks : Set<ShowReportCallBack> = new Set<ShowReportCallBack>();
|
||||||
@ -44,11 +42,6 @@ export class MediaManager {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
this.webrtcInAudio = HtmlUtils.getElementByIdOrFail<HTMLAudioElement>('audio-webrtc-in');
|
|
||||||
this.webrtcOutAudio = HtmlUtils.getElementByIdOrFail<HTMLAudioElement>('audio-webrtc-out');
|
|
||||||
this.webrtcInAudio.volume = 0.2;
|
|
||||||
this.webrtcOutAudio.volume = 0.2;
|
|
||||||
|
|
||||||
this.pingCameraStatus();
|
this.pingCameraStatus();
|
||||||
|
|
||||||
//FIX ME SOUNDMETER: check stability of sound meter calculation
|
//FIX ME SOUNDMETER: check stability of sound meter calculation
|
||||||
@ -129,7 +122,6 @@ export class MediaManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addActiveVideo(user: UserSimplePeerInterface, userName: string = ""){
|
addActiveVideo(user: UserSimplePeerInterface, userName: string = ""){
|
||||||
this.webrtcInAudio.play();
|
|
||||||
const userId = ''+user.userId
|
const userId = ''+user.userId
|
||||||
|
|
||||||
userName = userName.toUpperCase();
|
userName = userName.toUpperCase();
|
||||||
@ -277,10 +269,6 @@ export class MediaManager {
|
|||||||
this.removeActiveVideo(this.getScreenSharingId(userId))
|
this.removeActiveVideo(this.getScreenSharingId(userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
playWebrtcOutSound(): void {
|
|
||||||
this.webrtcOutAudio.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
isConnecting(userId: string): void {
|
isConnecting(userId: string): void {
|
||||||
const connectingSpinnerDiv = this.getSpinner(userId);
|
const connectingSpinnerDiv = this.getSpinner(userId);
|
||||||
if (connectingSpinnerDiv === null) {
|
if (connectingSpinnerDiv === null) {
|
||||||
|
@ -246,7 +246,6 @@ export class SimplePeer {
|
|||||||
* This is triggered twice. Once by the server, and once by a remote client disconnecting
|
* This is triggered twice. Once by the server, and once by a remote client disconnecting
|
||||||
*/
|
*/
|
||||||
private closeConnection(userId : number) {
|
private closeConnection(userId : number) {
|
||||||
mediaManager.playWebrtcOutSound();
|
|
||||||
try {
|
try {
|
||||||
const peer = this.PeerConnectionArray.get(userId);
|
const peer = this.PeerConnectionArray.get(userId);
|
||||||
if (peer === undefined) {
|
if (peer === undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user