[mirotalksfu] - add chat video/audio from url
هذا الالتزام موجود في:
@@ -440,11 +440,16 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.msg-text {
|
.msg-text {
|
||||||
|
display: inline-block;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.msg-text iframe {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.msg-a {
|
.msg-a {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2357,6 +2357,7 @@ class RoomClient {
|
|||||||
if (this.isHtml(message)) return this.stripHtml(message);
|
if (this.isHtml(message)) return this.stripHtml(message);
|
||||||
if (this.isValidHttpURL(message)) {
|
if (this.isValidHttpURL(message)) {
|
||||||
if (isImageURL(message)) return '<img src="' + message + '" alt="img" width="180" height="auto"/>';
|
if (isImageURL(message)) return '<img src="' + message + '" alt="img" width="180" height="auto"/>';
|
||||||
|
if (this.isVideoTypeSupported(message)) return this.getIframe(message);
|
||||||
return '<a href="' + message + '" target="_blank" class="msg-a">' + message + '</a>';
|
return '<a href="' + message + '" target="_blank" class="msg-a">' + message + '</a>';
|
||||||
}
|
}
|
||||||
if (isChatMarkdownOn) return marked.parse(message);
|
if (isChatMarkdownOn) return marked.parse(message);
|
||||||
@@ -2395,6 +2396,20 @@ class RoomClient {
|
|||||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIframe(url) {
|
||||||
|
let is_youtube = this.getVideoType(url) == 'na' ? true : false;
|
||||||
|
let video_audio_url = is_youtube ? this.getYoutubeEmbed(url) : url;
|
||||||
|
return `
|
||||||
|
<iframe
|
||||||
|
title="Chat-IFrame"
|
||||||
|
src="${video_audio_url}"
|
||||||
|
width="auto"
|
||||||
|
frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||||
|
allowfullscreen
|
||||||
|
></iframe>`;
|
||||||
|
}
|
||||||
|
|
||||||
getLineBreaks(message) {
|
getLineBreaks(message) {
|
||||||
return (message.match(/\n/g) || []).length;
|
return (message.match(/\n/g) || []).length;
|
||||||
}
|
}
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم