mirror of
https://github.com/tl-open-source/tl-rtc-file.git
synced 2025-09-26 19:41:16 +08:00
feat: web message notify
fix: values name err
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "10.5.1",
|
||||
"version": "10.5.2",
|
||||
"socket": {
|
||||
"port": "请到 tlrtcfile.env 中进行配置",
|
||||
"host": "请到 tlrtcfile.env 中进行配置"
|
||||
|
@@ -10,7 +10,7 @@ var audioShare = new Vue({
|
||||
return {
|
||||
stream: null,
|
||||
times: 0,
|
||||
interverlId: 0,
|
||||
intervalId: 0,
|
||||
track: null,
|
||||
}
|
||||
},
|
||||
@@ -29,7 +29,7 @@ var audioShare = new Vue({
|
||||
if(window.navigator.mediaDevices && window.navigator.mediaDevices.getUserMedia){
|
||||
media = window.navigator.mediaDevices.getUserMedia(defaultConstraints);
|
||||
} else if (window.navigator.mozGetUserMedia) {
|
||||
media = navagator.mozGetUserMedia(defaultConstraints);
|
||||
media = navigator.mozGetUserMedia(defaultConstraints);
|
||||
} else if (window.navigator.getUserMedia) {
|
||||
media = window.navigator.getUserMedia(defaultConstraints)
|
||||
} else if (window.navigator.webkitGetUserMedia) {
|
||||
@@ -87,7 +87,7 @@ var audioShare = new Vue({
|
||||
video.play();
|
||||
|
||||
//计算时间
|
||||
this.interverlId = setInterval(() => {
|
||||
this.intervalId = setInterval(() => {
|
||||
that.times += 1;
|
||||
window.Bus.$emit("changeAudioShareTimes", that.times)
|
||||
|
||||
@@ -113,7 +113,7 @@ var audioShare = new Vue({
|
||||
this.stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
|
||||
clearInterval(this.interverlId);
|
||||
clearInterval(this.intervalId);
|
||||
|
||||
window.Bus.$emit("changeAudioShareTimes", 0);
|
||||
|
||||
|
@@ -21,7 +21,7 @@ let useLocalNetworkRoomShare = (window.localStorage.getItem("tl-rtc-file-use-loc
|
||||
// 是否开启消息红点
|
||||
let useMessageDot = (window.localStorage.getItem("tl-rtc-file-use-message-dot") || "true") === 'true';
|
||||
// 是否开启浏览器系统消息通知
|
||||
let useWebMsgNotify = (window.localStorage.getItem("tl-rtc-file-use-web-msg-notify") || "true") === 'true';
|
||||
let useWebMsgNotify = (window.localStorage.getItem("tl-rtc-file-use-web-msg-notify") || "") === 'true';
|
||||
|
||||
axios.get("/api/comm/initData?turn="+useTurn, {}).then(async (initData) => {
|
||||
let { data : {
|
||||
@@ -1136,6 +1136,36 @@ axios.get("/api/comm/initData?turn="+useTurn, {}).then(async (initData) => {
|
||||
return
|
||||
}
|
||||
|
||||
//如果开启了系统弹窗 && 当前页面没有焦点
|
||||
if(this.webMsgNotify && !document.hasFocus()){
|
||||
//修改标签页title
|
||||
let title = document.title;
|
||||
let msg = data.title + " " + data.message;
|
||||
let time = 0;
|
||||
let timer = null;
|
||||
timer = setInterval(() => {
|
||||
time++;
|
||||
if(time % 2 === 0){
|
||||
document.title = msg;
|
||||
}else{
|
||||
document.title = title;
|
||||
}
|
||||
if(time > 10){
|
||||
clearInterval(timer);
|
||||
document.title = title;
|
||||
}
|
||||
}, 500);
|
||||
|
||||
//浏览器系统桌面消息通知
|
||||
if(window.Notification && Notification.permission === 'granted'){
|
||||
new Notification("tl-rtc-file通知" + data.title, {
|
||||
body: data.message,
|
||||
dir: 'auto',
|
||||
icon: '../image/44826979.png'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let levelTime = 1800;
|
||||
for(let len in lengthLevel){
|
||||
if(len > this.popUpList.length){
|
||||
@@ -4669,6 +4699,17 @@ axios.get("/api/comm/initData?turn="+useTurn, {}).then(async (initData) => {
|
||||
this.useWebMsgNotify = !this.useWebMsgNotify;
|
||||
|
||||
if (this.useWebMsgNotify) {
|
||||
// 开启通知开关的时候,如果没有通知权限,请求浏览器通知权限
|
||||
if (window.Notification) {
|
||||
if(Notification.permission !== "granted"){
|
||||
Notification.requestPermission(function (status) {
|
||||
if (Notification.permission !== status) {
|
||||
Notification.permission = status;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.localStorage.setItem("tl-rtc-file-use-web-message-notify", true)
|
||||
$("#webMsgNotifyOpen").css("display", "inline");
|
||||
$("#webMsgNotifyClose").css("display", "none");
|
||||
|
@@ -10,7 +10,7 @@ var liveShare = new Vue({
|
||||
return {
|
||||
stream: null,
|
||||
times: 0,
|
||||
interverlId: 0,
|
||||
intervalId: 0,
|
||||
track: null,
|
||||
}
|
||||
},
|
||||
@@ -72,7 +72,7 @@ var liveShare = new Vue({
|
||||
if(window.navigator.mediaDevices && window.navigator.mediaDevices.getUserMedia){
|
||||
media = window.navigator.mediaDevices.getUserMedia(defaultConstraints);
|
||||
} else if (window.navigator.mozGetUserMedia) {
|
||||
media = navagator.mozGetUserMedia(defaultConstraints);
|
||||
media = navigator.mozGetUserMedia(defaultConstraints);
|
||||
} else if (window.navigator.getUserMedia) {
|
||||
media = window.navigator.getUserMedia(defaultConstraints)
|
||||
} else if (window.navigator.webkitGetUserMedia) {
|
||||
@@ -140,7 +140,7 @@ var liveShare = new Vue({
|
||||
}
|
||||
|
||||
//计算时间
|
||||
this.interverlId = setInterval(() => {
|
||||
this.intervalId = setInterval(() => {
|
||||
that.times += 1;
|
||||
window.Bus.$emit("changeLiveShareTimes", that.times)
|
||||
|
||||
@@ -166,7 +166,7 @@ var liveShare = new Vue({
|
||||
this.stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
|
||||
clearInterval(this.interverlId);
|
||||
clearInterval(this.intervalId);
|
||||
|
||||
window.Bus.$emit("changeLiveShareTimes", 0);
|
||||
|
||||
|
@@ -13,7 +13,7 @@ const screen = new Vue({
|
||||
mediaRecorder: null, //录制对象
|
||||
recording: null, //录制文件
|
||||
times: 0, //录制时间
|
||||
interverlId: 0, //计时器id
|
||||
intervalId: 0, //计时器id
|
||||
size: 0, //录制文件大小
|
||||
isScreen : false, //是否正在录制
|
||||
}
|
||||
@@ -89,7 +89,7 @@ const screen = new Vue({
|
||||
this.mediaRecorder.start(10);
|
||||
|
||||
//计算时间
|
||||
this.interverlId = setInterval(() => {
|
||||
this.intervalId = setInterval(() => {
|
||||
that.times += 1;
|
||||
if(that.times < 10){
|
||||
$("#screenTimes").text("录制中: 0" + that.times + "秒")
|
||||
@@ -121,7 +121,7 @@ const screen = new Vue({
|
||||
this.stream.getTracks().forEach(track => track.stop());
|
||||
this.recording = window.URL.createObjectURL(new Blob(this.chunks, { type: 'video/webm' }));
|
||||
|
||||
clearInterval(this.interverlId);
|
||||
clearInterval(this.intervalId);
|
||||
|
||||
this.mediaRecorder = null;
|
||||
this.chunks = [];
|
||||
|
@@ -11,7 +11,7 @@ var screenShare = new Vue({
|
||||
return {
|
||||
stream: null,
|
||||
times: 0,
|
||||
interverlId: 0,
|
||||
intervalId: 0,
|
||||
track: null,
|
||||
}
|
||||
},
|
||||
@@ -82,7 +82,7 @@ var screenShare = new Vue({
|
||||
}
|
||||
|
||||
//计算时间
|
||||
this.interverlId = setInterval(() => {
|
||||
this.intervalId = setInterval(() => {
|
||||
that.times += 1;
|
||||
window.Bus.$emit("changeScreenShareTimes", that.times)
|
||||
$("#screenShareIcon").css("color","#fb0404")
|
||||
@@ -107,7 +107,7 @@ var screenShare = new Vue({
|
||||
this.stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
|
||||
clearInterval(this.interverlId);
|
||||
clearInterval(this.intervalId);
|
||||
|
||||
window.Bus.$emit("changeScreenShareTimes", 0)
|
||||
|
||||
|
@@ -10,7 +10,7 @@ var videoShare = new Vue({
|
||||
return {
|
||||
stream: null,
|
||||
times: 0,
|
||||
interverlId: 0,
|
||||
intervalId: 0,
|
||||
track: null,
|
||||
videoDeviceList: [], // 摄像头列表
|
||||
audioDeviceList: [], // 麦克风列表
|
||||
@@ -53,7 +53,7 @@ var videoShare = new Vue({
|
||||
if(window.navigator.mediaDevices && window.navigator.mediaDevices.getUserMedia){
|
||||
media = window.navigator.mediaDevices.getUserMedia(defaultConstraints);
|
||||
} else if (window.navigator.mozGetUserMedia) {
|
||||
media = navagator.mozGetUserMedia(defaultConstraints);
|
||||
media = navigator.mozGetUserMedia(defaultConstraints);
|
||||
} else if (window.navigator.getUserMedia) {
|
||||
media = window.navigator.getUserMedia(defaultConstraints)
|
||||
} else if (window.navigator.webkitGetUserMedia) {
|
||||
@@ -117,7 +117,7 @@ var videoShare = new Vue({
|
||||
}
|
||||
|
||||
//计算时间
|
||||
this.interverlId = setInterval(() => {
|
||||
this.intervalId = setInterval(() => {
|
||||
that.times += 1;
|
||||
window.Bus.$emit("changeVideoShareTimes", that.times)
|
||||
|
||||
@@ -143,7 +143,7 @@ var videoShare = new Vue({
|
||||
this.stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
|
||||
clearInterval(this.interverlId);
|
||||
clearInterval(this.intervalId);
|
||||
|
||||
window.Bus.$emit("changeVideoShareTimes", 0);
|
||||
|
||||
|
Reference in New Issue
Block a user