diff --git a/ui/src/pages/ScenarioCamera.js b/ui/src/pages/ScenarioCamera.js index a43d76ef..1ec332f2 100644 --- a/ui/src/pages/ScenarioCamera.js +++ b/ui/src/pages/ScenarioCamera.js @@ -18,7 +18,6 @@ export default function ScenarioCamera() { const [activeKey, setActiveKey] = React.useState(); const [secrets, setSecrets] = React.useState(); const handleError = useErrorHandler(); - const language = useSrsLanguage(); React.useEffect(() => { axios.post('/terraform/v1/ffmpeg/camera/secret', { @@ -113,7 +112,7 @@ function ScenarioCameraImpl({defaultActiveKey, defaultSecrets}) { refreshStreams(); const timer = setInterval(() => refreshStreams(), 10 * 1000); return () => clearInterval(timer); - }, [handleError]); + }, [t, handleError]); const updateSecrets = React.useCallback((e, action, platform, server, secret, enabled, custom, label, files, extraAudio, onSuccess) => { e.preventDefault(); @@ -136,7 +135,7 @@ function ScenarioCameraImpl({defaultActiveKey, defaultSecrets}) { } finally { new Promise(resolve => setTimeout(resolve, 3000)).then(() => setSubmiting(false)); } - }, [handleError, setSubmiting]); + }, [t, handleError, setSubmiting]); return ( @@ -464,7 +463,7 @@ function CameraStreamSelector({platform, cameraFiles, setCameraFiles}) { } finally { setSubmiting(false); } - }, [inputStream, handleError, platform, setCameraFiles, setSubmiting]); + }, [t, inputStream, handleError, platform, setCameraFiles, setSubmiting]); return (<> @@ -483,67 +482,6 @@ function CameraStreamSelector({platform, cameraFiles, setCameraFiles}) { ); } -function CameraStreamSelectorEn({platform, cameraFiles, setCameraFiles}) { - const handleError = useErrorHandler(); - const [inputStream, setInputStream] = React.useState(cameraFiles?.length ? cameraFiles[0].target : ''); - const [submiting, setSubmiting] = React.useState(); - - const checkStreamUrl = React.useCallback(async () => { - if (!inputStream) return alert('Please input stream URL'); - const isHTTP = inputStream.startsWith('http://') || inputStream.startsWith('https://'); - if (!inputStream.startsWith('rtmp://') && !inputStream.startsWith('rtsp://') && !isHTTP) return alert('The stream must be rtmp/http/https/rtsp'); - if (isHTTP && inputStream.indexOf('.flv') < 0 && inputStream.indexOf('.m3u8') < 0) return alert('The HTTP stream must be http-flv/hls'); - - setSubmiting(true); - try { - const res = await new Promise((resolve, reject) => { - axios.post(`/terraform/v1/ffmpeg/camera/stream-url`, { - url: inputStream, - }, { - headers: Token.loadBearerHeader(), - }).then(res => { - resolve(res); - }).catch(reject); - }); - - await new Promise((resolve, reject) => { - console.log(`Check stream url ok,${JSON.stringify(res.data.data)}`); - const streamObj = res.data.data; - const files = [{name: streamObj.name, size: 0, uuid: streamObj.uuid, target: streamObj.target, type: "stream"}]; - axios.post('/terraform/v1/ffmpeg/camera/source', { - platform, files, - }, { - headers: Token.loadBearerHeader(), - }).then(res => { - console.log(`Setup the virtual live stream ok,${JSON.stringify(res.data.data)}`); - setCameraFiles(res.data.data.files); - resolve(); - }).catch(reject); - }); - } catch (e) { - handleError(e); - } finally { - setSubmiting(false); - } - }, [inputStream, handleError, platform, setCameraFiles, setSubmiting]); - - return (<> - - {!cameraFiles?.length && <> - - - setInputStream(e.target.value)} /> - - - - - - } - {cameraFiles?.length && setCameraFiles(null)}/>} - - ) -} - function CameraFileFormatInfo({file}) { const f = file; if (!f?.format) return <>; diff --git a/ui/src/pages/ScenarioForward.js b/ui/src/pages/ScenarioForward.js index f6ca70ab..1ee8429b 100644 --- a/ui/src/pages/ScenarioForward.js +++ b/ui/src/pages/ScenarioForward.js @@ -8,7 +8,6 @@ import React from "react"; import {Token} from "../utils"; import axios from "axios"; import moment from "moment"; -import {TutorialsButton, useTutorials} from "../components/TutorialsButton"; import {useErrorHandler} from "react-error-boundary"; import {useSrsLanguage} from "../components/LanguageSwitch"; import {useTranslation} from "react-i18next"; @@ -18,7 +17,6 @@ export default function ScenarioForward() { const [activeKey, setActiveKey] = React.useState(); const [secrets, setSecrets] = React.useState(); const handleError = useErrorHandler(); - const language = useSrsLanguage(); React.useEffect(() => { axios.post('/terraform/v1/ffmpeg/forward/secret', { @@ -100,7 +98,7 @@ function ScenarioForwardImpl({defaultActiveKey, defaultSecrets}) { refreshStreams(); const timer = setInterval(() => refreshStreams(), 10 * 1000); return () => clearInterval(timer); - }, [handleError, setForwards]); + }, [t, handleError, setForwards]); const updateSecrets = React.useCallback((e, action, platform, server, secret, enabled, custom, label, onSuccess) => { e.preventDefault(); @@ -121,7 +119,7 @@ function ScenarioForwardImpl({defaultActiveKey, defaultSecrets}) { } finally { new Promise(resolve => setTimeout(resolve, 3000)).then(() => setSubmiting(false)); } - }, [handleError, setSubmiting]); + }, [t, handleError, setSubmiting]); return ( diff --git a/ui/src/pages/ScenarioLiveRoom.js b/ui/src/pages/ScenarioLiveRoom.js index 2c50c2af..b426395e 100644 --- a/ui/src/pages/ScenarioLiveRoom.js +++ b/ui/src/pages/ScenarioLiveRoom.js @@ -5,7 +5,7 @@ // import React from "react"; import {useSrsLanguage} from "../components/LanguageSwitch"; -import {Accordion, Button, Card, Form, Nav, Tab, Table, Tabs} from "react-bootstrap"; +import {Accordion, Button, Card, Form, Nav, Table} from "react-bootstrap"; import {useTranslation} from "react-i18next"; import axios from "axios"; import {Clipboard, Token} from "../utils"; @@ -292,6 +292,7 @@ function ScenarioLiveRoomManager({roomId, setRoomId}) { {t('lr.room.ai')} + On the way... diff --git a/ui/src/pages/ScenarioVLive.js b/ui/src/pages/ScenarioVLive.js index 75f157aa..b48c54f9 100644 --- a/ui/src/pages/ScenarioVLive.js +++ b/ui/src/pages/ScenarioVLive.js @@ -13,7 +13,6 @@ import {useSrsLanguage} from "../components/LanguageSwitch"; import FileUploader from "../components/FileUploader"; import {useTranslation} from "react-i18next"; import {SrsErrorBoundary} from "../components/SrsErrorBoundary"; -import {TutorialsButton, useTutorials} from "../components/TutorialsButton"; export default function ScenarioVLive() { const [init, setInit] = React.useState(); @@ -111,7 +110,7 @@ function ScenarioVLiveImpl({defaultActiveKey, defaultSecrets}) { refreshStreams(); const timer = setInterval(() => refreshStreams(), 10 * 1000); return () => clearInterval(timer); - }, [handleError]); + }, [t, handleError]); const updateSecrets = React.useCallback((e, action, platform, server, secret, enabled, custom, label, files, onSuccess) => { e.preventDefault(); @@ -133,7 +132,7 @@ function ScenarioVLiveImpl({defaultActiveKey, defaultSecrets}) { } finally { new Promise(resolve => setTimeout(resolve, 3000)).then(() => setSubmiting(false)); } - }, [handleError, setSubmiting]); + }, [t, handleError, setSubmiting]); return ( @@ -481,7 +480,7 @@ function VLiveStreamSelector({platform, vLiveFiles, setVLiveFiles}) { } finally { setSubmiting(false); } - }, [inputStream, handleError, platform, setVLiveFiles, setSubmiting]); + }, [t, inputStream, handleError, platform, setVLiveFiles, setSubmiting]); return (<> @@ -530,7 +529,7 @@ function VLiveFileSelector({platform, vLiveFiles, setVLiveFiles}) { setVLiveFiles(res.data.data.files); }).catch(handleError); }).catch(handleError); - }, [inputFile, handleError, platform, setVLiveFiles]); + }, [t, inputFile, handleError, platform, setVLiveFiles]); return (<> @@ -565,7 +564,7 @@ function VLiveFileUploader({platform, vLiveFiles, setVLiveFiles}) { console.log(`${t('plat.tool.upload3')}, ${JSON.stringify(res.data.data)}`); setFiles(res.data.data.files); }).catch(handleError); - }, [handleError]); + }, [t, handleError]); return (<>