'ss'
This commit is contained in:
@@ -18,8 +18,11 @@
|
|||||||
<p class="modified">
|
<p class="modified">
|
||||||
<time :datetime="modified">{{ humanTime() }}</time>
|
<time :datetime="modified">{{ humanTime() }}</time>
|
||||||
<!-- 直播按钮 -->
|
<!-- 直播按钮 -->
|
||||||
|
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="loopLive">
|
||||||
|
循环直播
|
||||||
|
</button>
|
||||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="startLive">
|
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="startLive">
|
||||||
开始直播
|
单次直播
|
||||||
</button>
|
</button>
|
||||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="stopLive">
|
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="stopLive">
|
||||||
停止直播
|
停止直播
|
||||||
@@ -399,6 +402,35 @@ const stopLive = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const loopLive = async () => {
|
||||||
|
try {
|
||||||
|
// props.url 是 FileBrowser 内部路径,例如 /videos/test.mp4
|
||||||
|
const file_path = props.url;
|
||||||
|
// const file_path = encodeURIComponent(props.url);
|
||||||
|
console.log('file_path',file_path)
|
||||||
|
|
||||||
|
// 调用 FastAPI 后端接口
|
||||||
|
const res = await fetch("http://live.local:8700/loop_Live", {
|
||||||
|
// const res = await fetch("http://192.168.31.245:8700/start_live", {
|
||||||
|
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ filename: file_path })
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
if (data.status === "ok") {
|
||||||
|
alert(`直播已开始: ${file_path}`);
|
||||||
|
} else {
|
||||||
|
alert(`直播失败: ${data.msg}`);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
alert("直播接口调用失败,请检查后端服务是否启动");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const startLive = async () => {
|
const startLive = async () => {
|
||||||
try {
|
try {
|
||||||
// props.url 是 FileBrowser 内部路径,例如 /videos/test.mp4
|
// props.url 是 FileBrowser 内部路径,例如 /videos/test.mp4
|
||||||
|
|||||||
Reference in New Issue
Block a user