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