mtxt-ui3 0.0.2 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +103 -98
- package/dist/components/index.d.ts +26 -8
- package/dist/components/index.js +104 -99
- package/dist/hooks/index.cjs +19 -11
- package/dist/hooks/index.js +19 -11
- package/dist/index.cjs +104 -99
- package/dist/index.d.ts +27 -9
- package/dist/index.js +105 -100
- package/dist/video/index.cjs +111 -106
- package/dist/video/index.d.ts +26 -8
- package/dist/video/index.js +112 -107
- package/package.json +1 -1
|
@@ -6454,11 +6454,12 @@ class RTCEndpoint extends Event$1 {
|
|
|
6454
6454
|
const Events = Events$1;
|
|
6455
6455
|
const Endpoint = RTCEndpoint;
|
|
6456
6456
|
|
|
6457
|
-
const appName$1 = "live";
|
|
6458
6457
|
class WebRtcMt$1 {
|
|
6459
6458
|
constructor(opt) {
|
|
6459
|
+
this.opt = opt;
|
|
6460
6460
|
this.init(opt);
|
|
6461
6461
|
}
|
|
6462
|
+
opt;
|
|
6462
6463
|
dom;
|
|
6463
6464
|
p_player;
|
|
6464
6465
|
// 返回播放视频数据
|
|
@@ -6481,11 +6482,10 @@ class WebRtcMt$1 {
|
|
|
6481
6482
|
addRtspProxyUrl
|
|
6482
6483
|
} = plays;
|
|
6483
6484
|
const stream = `v${cameraIp}-${cameraRtspPort}-${cameraChannel}-${cameraStream}`;
|
|
6484
|
-
const sdpUrl = `${mediaServerAddr}/index/api/webrtc?app=${appName$1}&stream=${stream}&type=play`;
|
|
6485
6485
|
return {
|
|
6486
6486
|
stream,
|
|
6487
6487
|
addRtspProxyUrl,
|
|
6488
|
-
sdpUrl: mediaServerAddr
|
|
6488
|
+
sdpUrl: mediaServerAddr
|
|
6489
6489
|
};
|
|
6490
6490
|
}
|
|
6491
6491
|
// 初始化
|
|
@@ -6503,6 +6503,7 @@ class WebRtcMt$1 {
|
|
|
6503
6503
|
}
|
|
6504
6504
|
}
|
|
6505
6505
|
}
|
|
6506
|
+
// protected retryTime;
|
|
6506
6507
|
// 拉流创建播放器
|
|
6507
6508
|
createVideo(plays) {
|
|
6508
6509
|
this.mediaServerAddrMap.set(plays.videoElm, plays);
|
|
@@ -6516,13 +6517,17 @@ class WebRtcMt$1 {
|
|
|
6516
6517
|
response.json().then(res => {
|
|
6517
6518
|
if (res.code === 0) {
|
|
6518
6519
|
this.startPlay(plays);
|
|
6519
|
-
resolve(res);
|
|
6520
6520
|
} else {
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6521
|
+
setTimeout(() => {
|
|
6522
|
+
this.rePlay();
|
|
6523
|
+
}, 3 * 60 * 1e3);
|
|
6524
6524
|
}
|
|
6525
|
+
resolve(res);
|
|
6525
6526
|
});
|
|
6527
|
+
}).catch(err => {
|
|
6528
|
+
setTimeout(() => {
|
|
6529
|
+
this.rePlay();
|
|
6530
|
+
}, 3 * 60 * 1e3);
|
|
6526
6531
|
});
|
|
6527
6532
|
});
|
|
6528
6533
|
}
|
|
@@ -6554,10 +6559,12 @@ class WebRtcMt$1 {
|
|
|
6554
6559
|
// 注册事件监听
|
|
6555
6560
|
playEvent(player, videoElm, sdpUrl) {
|
|
6556
6561
|
player.on(Events.WEBRTC_ICE_CANDIDATE_ERROR, e => {
|
|
6557
|
-
this.log("
|
|
6562
|
+
this.log("warn", "ICE \u534F\u5546\u51FA\u9519");
|
|
6558
6563
|
this.rePlay(videoElm);
|
|
6559
6564
|
});
|
|
6560
|
-
player.on(Events.WEBRTC_ON_REMOTE_STREAMS, e => {
|
|
6565
|
+
player.on(Events.WEBRTC_ON_REMOTE_STREAMS, e => {
|
|
6566
|
+
this.log("warn", "\u83B7\u53D6\u5230\u4E86\u8FDC\u7AEF\u6D41\uFF0C\u53EF\u4EE5\u64AD\u653E");
|
|
6567
|
+
});
|
|
6561
6568
|
player.on(Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, e => {
|
|
6562
6569
|
this.log("warn", `offer anwser \u4EA4\u6362\u5931\u8D25\uFF0C\u83B7\u53D6\u89C6\u9891\u6D41\u5931\u8D25, ${e}`);
|
|
6563
6570
|
this.rePlay(videoElm);
|
|
@@ -6578,9 +6585,10 @@ class WebRtcMt$1 {
|
|
|
6578
6585
|
}
|
|
6579
6586
|
// 重播
|
|
6580
6587
|
rePlay(videoElm) {
|
|
6588
|
+
this.stopPlay();
|
|
6581
6589
|
setTimeout(() => {
|
|
6582
|
-
this.
|
|
6583
|
-
},
|
|
6590
|
+
this.init(this.opt);
|
|
6591
|
+
}, 5 * 1e3);
|
|
6584
6592
|
}
|
|
6585
6593
|
// 播放
|
|
6586
6594
|
play(videoElm) {
|
|
@@ -6634,10 +6642,18 @@ const props$7 = {
|
|
|
6634
6642
|
require: false,
|
|
6635
6643
|
default: "fill"
|
|
6636
6644
|
},
|
|
6637
|
-
//
|
|
6638
|
-
|
|
6639
|
-
type:
|
|
6640
|
-
default:
|
|
6645
|
+
// token
|
|
6646
|
+
token: {
|
|
6647
|
+
type: String,
|
|
6648
|
+
default: ""
|
|
6649
|
+
},
|
|
6650
|
+
baseUrl: {
|
|
6651
|
+
type: String,
|
|
6652
|
+
default: ""
|
|
6653
|
+
},
|
|
6654
|
+
domId: {
|
|
6655
|
+
type: String,
|
|
6656
|
+
default: ""
|
|
6641
6657
|
}
|
|
6642
6658
|
};
|
|
6643
6659
|
const VideoPlayerV2 = vue.defineComponent({
|
|
@@ -6645,8 +6661,7 @@ const VideoPlayerV2 = vue.defineComponent({
|
|
|
6645
6661
|
emits: ["changeStream"],
|
|
6646
6662
|
setup(_prop, _context) {
|
|
6647
6663
|
let play;
|
|
6648
|
-
const
|
|
6649
|
-
const uuid = UUID();
|
|
6664
|
+
const uuid = _prop.domId;
|
|
6650
6665
|
const videoFull = id => {
|
|
6651
6666
|
const elm = document.getElementById(`videoPlayer_${uuid}`);
|
|
6652
6667
|
if (elm.requestFullScreen) {
|
|
@@ -6656,16 +6671,15 @@ const VideoPlayerV2 = vue.defineComponent({
|
|
|
6656
6671
|
} else if (elm.webkitRequestFullScreen) {
|
|
6657
6672
|
elm.webkitRequestFullScreen();
|
|
6658
6673
|
}
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6674
|
+
if (videoInfo2.value.brandTypeCode !== "MP4") {
|
|
6675
|
+
setTimeout(() => {
|
|
6676
|
+
window.onresize = () => {
|
|
6677
|
+
_context.emit("changeStream");
|
|
6678
|
+
};
|
|
6679
|
+
}, 500);
|
|
6680
|
+
}
|
|
6664
6681
|
};
|
|
6665
|
-
|
|
6666
|
-
videoFull
|
|
6667
|
-
});
|
|
6668
|
-
const videoInfo2 = vue.ref();
|
|
6682
|
+
const videoInfo2 = vue.ref({});
|
|
6669
6683
|
const stopPlay = () => {
|
|
6670
6684
|
if (play) {
|
|
6671
6685
|
play.stopPlay(`videoPlayer_${uuid}`);
|
|
@@ -6678,56 +6692,30 @@ const VideoPlayerV2 = vue.defineComponent({
|
|
|
6678
6692
|
...camera,
|
|
6679
6693
|
..._prop.cameraConfig
|
|
6680
6694
|
};
|
|
6681
|
-
const {
|
|
6682
|
-
channel,
|
|
6683
|
-
streamType
|
|
6684
|
-
} = camera;
|
|
6685
6695
|
let url = camera.webrtcTemplateMerged;
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
addRtspProxyUrl: url
|
|
6700
|
-
}
|
|
6701
|
-
});
|
|
6702
|
-
} else {
|
|
6703
|
-
play = new WebRtcMt$1({
|
|
6704
|
-
plays: {
|
|
6705
|
-
videoElm: `videoPlayer_${uuid}`,
|
|
6706
|
-
mediaServerAddr: camera.mediaServerPo.url,
|
|
6707
|
-
cameraUserName: camera.user,
|
|
6708
|
-
cameraPwd: camera.pass,
|
|
6709
|
-
cameraIp: camera.ip,
|
|
6710
|
-
cameraRtspPort: camera.rtspPort,
|
|
6711
|
-
cameraChannel: camera.channel,
|
|
6712
|
-
cameraStream: camera.streamType,
|
|
6713
|
-
addRtspProxyUrl: url
|
|
6714
|
-
}
|
|
6715
|
-
});
|
|
6716
|
-
}
|
|
6696
|
+
play = new WebRtcMt$1({
|
|
6697
|
+
plays: {
|
|
6698
|
+
videoElm: `videoPlayer_${uuid}`,
|
|
6699
|
+
mediaServerAddr: camera.mediaServerPo.url,
|
|
6700
|
+
cameraUserName: camera.user,
|
|
6701
|
+
cameraPwd: camera.pass,
|
|
6702
|
+
cameraIp: camera.ip,
|
|
6703
|
+
cameraRtspPort: camera.rtspPort,
|
|
6704
|
+
cameraChannel: camera.channel,
|
|
6705
|
+
cameraStream: camera.streamType,
|
|
6706
|
+
addRtspProxyUrl: url
|
|
6707
|
+
}
|
|
6708
|
+
});
|
|
6717
6709
|
};
|
|
6718
|
-
const
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
videoElement.removeAttribute("src");
|
|
6723
|
-
videoElement.load();
|
|
6724
|
-
}
|
|
6710
|
+
const releaseUrl = vue.ref("");
|
|
6711
|
+
const release = async () => {
|
|
6712
|
+
const res = await axios__default["default"].get(releaseUrl.value);
|
|
6713
|
+
return res;
|
|
6725
6714
|
};
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
}, _prop.intervalTime);
|
|
6715
|
+
_context.expose({
|
|
6716
|
+
videoFull,
|
|
6717
|
+
release
|
|
6718
|
+
});
|
|
6731
6719
|
const getVideoDetail = async camera => {
|
|
6732
6720
|
let uuid2 = "";
|
|
6733
6721
|
if (camera && Object.keys(camera).length && typeof camera === "object") {
|
|
@@ -6735,34 +6723,39 @@ const VideoPlayerV2 = vue.defineComponent({
|
|
|
6735
6723
|
} else if (camera && typeof camera === "string") {
|
|
6736
6724
|
uuid2 = camera;
|
|
6737
6725
|
}
|
|
6738
|
-
|
|
6739
|
-
|
|
6726
|
+
if (!uuid2) {
|
|
6727
|
+
return;
|
|
6728
|
+
}
|
|
6729
|
+
const detailRes = await axios__default["default"].get(`${_prop.baseUrl}/api/vms/v1/camera/getByUuid?uuid=${uuid2}`, {
|
|
6740
6730
|
headers: {
|
|
6741
|
-
token: sessionStorage.getItem("token") || ""
|
|
6731
|
+
token: _prop.token || sessionStorage.getItem("token") || ""
|
|
6742
6732
|
}
|
|
6743
6733
|
});
|
|
6744
|
-
const res = await
|
|
6745
|
-
const urlResponse = await fetch(`/api/vms/v1/camera/getWebrtcUrls?uuid=${uuid2}`, {
|
|
6746
|
-
method: "GET",
|
|
6734
|
+
const res = await axios__default["default"].get(`${_prop.baseUrl}/api/vms/v1/camera/getWebrtcUrls?uuid=${uuid2}`, {
|
|
6747
6735
|
headers: {
|
|
6748
|
-
token: sessionStorage.getItem("token") || ""
|
|
6736
|
+
token: _prop.token || sessionStorage.getItem("token") || ""
|
|
6749
6737
|
}
|
|
6750
6738
|
});
|
|
6751
|
-
const
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6739
|
+
const {
|
|
6740
|
+
data
|
|
6741
|
+
} = detailRes;
|
|
6742
|
+
videoInfo2.value = {
|
|
6743
|
+
...data.data,
|
|
6744
|
+
..._prop.cameraConfig
|
|
6745
|
+
};
|
|
6746
|
+
if (res.status === 200) {
|
|
6747
|
+
if (res.data.data[0]) {
|
|
6748
|
+
videoInfo2.value.webrtcTemplateMerged = res.data.data[0];
|
|
6749
|
+
releaseUrl.value = res.data.data[1];
|
|
6750
|
+
if (videoInfo2.value.mediaServerPo) {
|
|
6751
|
+
videoInfo2.value.mediaServerPo.url = res.data.data[2];
|
|
6752
|
+
}
|
|
6753
|
+
init();
|
|
6758
6754
|
}
|
|
6759
|
-
videoInfo2.value = camera2;
|
|
6760
|
-
init();
|
|
6761
6755
|
}
|
|
6762
6756
|
};
|
|
6763
6757
|
vue.watch([() => _prop.camera, () => _prop.cameraConfig], ([camera, cameraConfig]) => {
|
|
6764
6758
|
stopPlay();
|
|
6765
|
-
stopV(`videoPlayer_${uuid}`);
|
|
6766
6759
|
getVideoDetail(camera);
|
|
6767
6760
|
}, {
|
|
6768
6761
|
immediate: true,
|
|
@@ -6770,15 +6763,27 @@ const VideoPlayerV2 = vue.defineComponent({
|
|
|
6770
6763
|
});
|
|
6771
6764
|
vue.onBeforeUnmount(() => {
|
|
6772
6765
|
stopPlay();
|
|
6773
|
-
stopV(`videoPlayer_${uuid}`);
|
|
6774
|
-
clearInterval(timer);
|
|
6775
6766
|
});
|
|
6776
|
-
|
|
6777
|
-
"
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6767
|
+
const renderVideo = () => {
|
|
6768
|
+
if (videoInfo2.value.brandTypeCode === "MP4") {
|
|
6769
|
+
return vue.createVNode("video", {
|
|
6770
|
+
"id": `videoPlayer_${uuid}`,
|
|
6771
|
+
"class": "videoComponent fill",
|
|
6772
|
+
"src": videoInfo2.value.mp4ResourcesPath,
|
|
6773
|
+
"autoplay": true,
|
|
6774
|
+
"loop": true,
|
|
6775
|
+
"muted": true
|
|
6776
|
+
}, null);
|
|
6777
|
+
} else {
|
|
6778
|
+
return vue.createVNode("video", {
|
|
6779
|
+
"id": `videoPlayer_${uuid}`,
|
|
6780
|
+
"class": `videoComponent ${_prop.fill}`,
|
|
6781
|
+
"muted": true,
|
|
6782
|
+
"autoplay": true
|
|
6783
|
+
}, null);
|
|
6784
|
+
}
|
|
6785
|
+
};
|
|
6786
|
+
return () => vue.createVNode(vue.Fragment, null, [renderVideo()]);
|
|
6782
6787
|
}
|
|
6783
6788
|
});
|
|
6784
6789
|
var videoPlayerV2 = installComponent(VideoPlayerV2, "video-player-v2");
|
|
@@ -79,7 +79,7 @@ declare const _default$c: vue.DefineComponent<{
|
|
|
79
79
|
}, {}>;
|
|
80
80
|
|
|
81
81
|
interface videoInfo$1 {
|
|
82
|
-
[key: string]: string | number | boolean | videoInfo$1 | Array<videoInfo$1
|
|
82
|
+
[key: string]: string | number | boolean | videoInfo$1 | Array<videoInfo$1> | any;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
declare const _default$b: vue.DefineComponent<{
|
|
@@ -95,9 +95,17 @@ declare const _default$b: vue.DefineComponent<{
|
|
|
95
95
|
require: boolean;
|
|
96
96
|
default: string;
|
|
97
97
|
};
|
|
98
|
-
|
|
99
|
-
type:
|
|
100
|
-
default:
|
|
98
|
+
token: {
|
|
99
|
+
type: StringConstructor;
|
|
100
|
+
default: string;
|
|
101
|
+
};
|
|
102
|
+
baseUrl: {
|
|
103
|
+
type: StringConstructor;
|
|
104
|
+
default: string;
|
|
105
|
+
};
|
|
106
|
+
domId: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
default: string;
|
|
101
109
|
};
|
|
102
110
|
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "changeStream"[], "changeStream", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
103
111
|
camera: {
|
|
@@ -112,16 +120,26 @@ declare const _default$b: vue.DefineComponent<{
|
|
|
112
120
|
require: boolean;
|
|
113
121
|
default: string;
|
|
114
122
|
};
|
|
115
|
-
|
|
116
|
-
type:
|
|
117
|
-
default:
|
|
123
|
+
token: {
|
|
124
|
+
type: StringConstructor;
|
|
125
|
+
default: string;
|
|
126
|
+
};
|
|
127
|
+
baseUrl: {
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
default: string;
|
|
130
|
+
};
|
|
131
|
+
domId: {
|
|
132
|
+
type: StringConstructor;
|
|
133
|
+
default: string;
|
|
118
134
|
};
|
|
119
135
|
}>> & {
|
|
120
136
|
onChangeStream?: ((...args: any[]) => any) | undefined;
|
|
121
137
|
}, {
|
|
122
138
|
fill: string;
|
|
123
139
|
cameraConfig: Record<string, any>;
|
|
124
|
-
|
|
140
|
+
token: string;
|
|
141
|
+
baseUrl: string;
|
|
142
|
+
domId: string;
|
|
125
143
|
}, {}>;
|
|
126
144
|
|
|
127
145
|
interface videoInfo {
|