|
|
@ -363,17 +363,18 @@ export class HomeComponent implements OnInit { |
|
|
|
messageId = []; |
|
|
|
messageId = []; |
|
|
|
receiptOfNotification(userNotification) { |
|
|
|
receiptOfNotification(userNotification) { |
|
|
|
if (this.isWarningVoice) { |
|
|
|
if (this.isWarningVoice) { |
|
|
|
if (!window.speechSynthesis) { |
|
|
|
// if (!window.speechSynthesis) {
|
|
|
|
this.message.create("warning", `该游览器不支持语音播报`); |
|
|
|
// this.message.create("warning", `该游览器不支持语音播报`);
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
let speakMsg = new SpeechSynthesisUtterance( |
|
|
|
// let speakMsg = new SpeechSynthesisUtterance(
|
|
|
|
"请注意,收到一条新的预警信息,请及时处理!" |
|
|
|
// "请注意,收到一条新的预警信息,请及时处理!"
|
|
|
|
); |
|
|
|
// );
|
|
|
|
speakMsg.lang = "zh-CN"; |
|
|
|
// speakMsg.lang = "zh-CN";
|
|
|
|
speakMsg.rate = 1; |
|
|
|
// speakMsg.rate = 1;
|
|
|
|
speakMsg.pitch = 1.5; |
|
|
|
// speakMsg.pitch = 1.5;
|
|
|
|
window.speechSynthesis.speak(speakMsg); |
|
|
|
// window.speechSynthesis.speak(speakMsg);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
this.Sound(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.isWarningWindow) { |
|
|
|
if (this.isWarningWindow) { |
|
|
|
let obj = { |
|
|
|
let obj = { |
|
|
@ -388,7 +389,11 @@ export class HomeComponent implements OnInit { |
|
|
|
this.messageId.push(obj); |
|
|
|
this.messageId.push(obj); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Sound() { |
|
|
|
|
|
|
|
var mp3Url = "../../../assets/sound/warning.mp3"; |
|
|
|
|
|
|
|
var player = new Audio(mp3Url); |
|
|
|
|
|
|
|
player.play(); //播放 mp3这个音频对象
|
|
|
|
|
|
|
|
} |
|
|
|
modalData; |
|
|
|
modalData; |
|
|
|
look(item) { |
|
|
|
look(item) { |
|
|
|
console.log("推送信息", item); |
|
|
|
console.log("推送信息", item); |
|
|
|