|
|
|
@ -320,31 +320,80 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
this.messageId.push(obj); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
msg = new SpeechSynthesisUtterance(); |
|
|
|
|
playingViolationName = ""; |
|
|
|
|
Sound(userNotification) { |
|
|
|
|
let violationName = |
|
|
|
|
userNotification.notification.data.properties.ViolationName; |
|
|
|
|
let CameraNo = userNotification.notification.data.properties.CameraNo; |
|
|
|
|
const soundMap = { |
|
|
|
|
油罐区非工作人员闯入: "../../../assets/sound/chuangru.mp3", |
|
|
|
|
进出口长时间停放车辆: "../../../assets/sound/jinchukou.mp3", |
|
|
|
|
前庭有顾客疑似抽烟: "../../../assets/sound/chouyan.mp3", |
|
|
|
|
前庭有顾客接打电话: "../../../assets/sound/dadianhua.mp3", |
|
|
|
|
卸油前未按规定设置隔离: "../../../assets/sound/xygeli.mp3", |
|
|
|
|
卸油后未按规定拆除卸油管: "../../../assets/sound/xychaichuxyguan.mp3", |
|
|
|
|
卸油前未按规定连接静电接地: "../../../assets/sound/xyjiedi.mp3", |
|
|
|
|
卸油前未按规定放置灭火器: "../../../assets/sound/xymiehuoqi.mp3", |
|
|
|
|
卸油后长时间未清理现场: "../../../assets/sound/xyxianchang.mp3", |
|
|
|
|
油罐车长时间无人卸油: "../../../assets/sound/xywuren.mp3", |
|
|
|
|
卸油前未按规定连接卸油管: "../../../assets/sound/xyxieyouguan.mp3", |
|
|
|
|
卸油中未按规定全程监卸: "../../../assets/sound/xyjianxie.mp3", |
|
|
|
|
疑似烟雾: "../../../assets/sound/yanwu.mp3", |
|
|
|
|
疑似明火: "../../../assets/sound/minghuo.mp3", |
|
|
|
|
油罐区非工作人员闯入: `请注意,${CameraNo}有非工作人员闯入,请及时处理`, |
|
|
|
|
进出口长时间停放车辆: `请注意,${CameraNo}有长时间停放车辆,请及时处理`, |
|
|
|
|
前庭有顾客疑似抽烟: `请注意,${CameraNo}有顾客疑似抽烟,请及时处理`, |
|
|
|
|
前庭有顾客接打电话: `请注意,${CameraNo}有顾客接打电话,请及时处理`, |
|
|
|
|
卸油前未按规定设置隔离: "请注意,卸油前未按规定设置隔离,请及时处理", |
|
|
|
|
卸油后未按规定拆除卸油管: "请注意,卸油后未按规定拆除卸油管,请及时处理", |
|
|
|
|
卸油前未按规定连接静电接地: |
|
|
|
|
"请注意,卸油前未按规定连接静电接地,请及时处理", |
|
|
|
|
卸油前未按规定放置灭火器: "请注意,卸油前未按规定放置灭火器,请及时处理", |
|
|
|
|
卸油后长时间未清理现场: "请注意,卸油后长时间未清理现场,请及时处理", |
|
|
|
|
油罐车长时间无人卸油: "请注意,油罐车长时间无人卸油,请及时处理", |
|
|
|
|
卸油前未按规定连接卸油管: "请注意,卸油前未按规定连接卸油管,请及时处理", |
|
|
|
|
卸油中未按规定全程监卸: "请注意,卸油中未按规定全程监卸,请及时处理", |
|
|
|
|
疑似烟雾: `请注意,${CameraNo}疑似出现烟雾,请及时处理`, |
|
|
|
|
疑似明火: `请注意,${CameraNo}疑似出现明火,请及时处理`, |
|
|
|
|
"收银员未穿工装/非工作人员闯入收银区": |
|
|
|
|
"../../../assets/sound/gongzhuang.mp3", |
|
|
|
|
default: "../../../assets/sound/warning.mp3", |
|
|
|
|
"请注意,收银员未穿工装或非工作人员闯入收银区,请及时处理", |
|
|
|
|
}; |
|
|
|
|
if (violationName == "前庭有顾客疑似抽烟") { |
|
|
|
|
window.speechSynthesis.cancel(); |
|
|
|
|
} |
|
|
|
|
if ( |
|
|
|
|
violationName == "前庭有顾客接打电话" && |
|
|
|
|
this.playingViolationName !== "前庭有顾客疑似抽烟" |
|
|
|
|
) { |
|
|
|
|
window.speechSynthesis.cancel(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果你想控制语速、音量或声音等
|
|
|
|
|
this.msg.text = |
|
|
|
|
soundMap[violationName] || "请注意,收到一条新的预警信息,请及时处理"; |
|
|
|
|
this.msg.rate = 0.8; // 语速,默认值为1
|
|
|
|
|
this.msg.volume = 1; // 音量,0到1之间
|
|
|
|
|
this.msg.lang = "zh-CN"; // 语言,支持多种语言
|
|
|
|
|
|
|
|
|
|
this.playingViolationName = violationName; |
|
|
|
|
window.speechSynthesis.speak(this.msg); |
|
|
|
|
|
|
|
|
|
// 监听语音结束事件
|
|
|
|
|
this.msg.onend = () => { |
|
|
|
|
this.playingViolationName = ""; |
|
|
|
|
}; |
|
|
|
|
const audioUrl = soundMap[violationName] || soundMap.default; |
|
|
|
|
var player = new Audio(audioUrl); |
|
|
|
|
player.play(); //播放 mp3这个音频对象
|
|
|
|
|
// let violationName =
|
|
|
|
|
// userNotification.notification.data.properties.ViolationName;
|
|
|
|
|
// const soundMap = {
|
|
|
|
|
// 油罐区非工作人员闯入: "../../../assets/sound/chuangru.mp3",
|
|
|
|
|
// 进出口长时间停放车辆: "../../../assets/sound/jinchukou.mp3",
|
|
|
|
|
// 前庭有顾客疑似抽烟: "../../../assets/sound/chouyan.mp3",
|
|
|
|
|
// 前庭有顾客接打电话: "../../../assets/sound/dadianhua.mp3",
|
|
|
|
|
// 卸油前未按规定设置隔离: "../../../assets/sound/xygeli.mp3",
|
|
|
|
|
// 卸油后未按规定拆除卸油管: "../../../assets/sound/xychaichuxyguan.mp3",
|
|
|
|
|
// 卸油前未按规定连接静电接地: "../../../assets/sound/xyjiedi.mp3",
|
|
|
|
|
// 卸油前未按规定放置灭火器: "../../../assets/sound/xymiehuoqi.mp3",
|
|
|
|
|
// 卸油后长时间未清理现场: "../../../assets/sound/xyxianchang.mp3",
|
|
|
|
|
// 油罐车长时间无人卸油: "../../../assets/sound/xywuren.mp3",
|
|
|
|
|
// 卸油前未按规定连接卸油管: "../../../assets/sound/xyxieyouguan.mp3",
|
|
|
|
|
// 卸油中未按规定全程监卸: "../../../assets/sound/xyjianxie.mp3",
|
|
|
|
|
// 疑似烟雾: "../../../assets/sound/yanwu.mp3",
|
|
|
|
|
// 疑似明火: "../../../assets/sound/minghuo.mp3",
|
|
|
|
|
// "收银员未穿工装/非工作人员闯入收银区":
|
|
|
|
|
// "../../../assets/sound/gongzhuang.mp3",
|
|
|
|
|
// default: "../../../assets/sound/warning.mp3",
|
|
|
|
|
// };
|
|
|
|
|
// const audioUrl = soundMap[violationName] || soundMap.default;
|
|
|
|
|
// var player = new Audio(audioUrl);
|
|
|
|
|
// player.play(); //播放 mp3这个音频对象
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
modalData; |
|
|
|
|