mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 02:24:16 +00:00
Fix rtspt url media
This commit is contained in:
parent
edf8b8c05f
commit
179496b061
@ -11,7 +11,35 @@ const MediaUrls = ({ profile }) => {
|
|||||||
|
|
||||||
const { hls, rtsp, html } = sources
|
const { hls, rtsp, html } = sources
|
||||||
|
|
||||||
const rtspt = rtsp ? rtsp.replace("rtsp://", "rtspt://") : null
|
let rtspt = null
|
||||||
|
|
||||||
|
if (rtsp) {
|
||||||
|
try {
|
||||||
|
const url = new URL(rtsp)
|
||||||
|
|
||||||
|
const pathParts = url.pathname.split("/")
|
||||||
|
const lastPart = pathParts.pop()
|
||||||
|
const [resource, query] = lastPart.split("?")
|
||||||
|
|
||||||
|
let stoken = url.searchParams.get("stoken")
|
||||||
|
|
||||||
|
let newLastPart = resource
|
||||||
|
|
||||||
|
if (stoken) {
|
||||||
|
newLastPart = `${resource}:${stoken}`
|
||||||
|
}
|
||||||
|
|
||||||
|
pathParts.push(newLastPart)
|
||||||
|
|
||||||
|
url.protocol = "rtspt:"
|
||||||
|
url.pathname = pathParts.join("/")
|
||||||
|
url.search = ""
|
||||||
|
|
||||||
|
rtspt = url.toString()
|
||||||
|
} catch (err) {
|
||||||
|
rtspt = rtsp.replace("rtsp://", "rtspt://")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="profile-section content-panel">
|
<div className="profile-section content-panel">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user