's'
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"pnpm": ">=9.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"dev": "vite dev --host 0.0.0.0",
|
||||
"build": "pnpm run typecheck && vite build",
|
||||
"clean": "find ./dist -maxdepth 1 -mindepth 1 ! -name '.gitkeep' -exec rm -r {} +",
|
||||
"typecheck": "vue-tsc -p ./tsconfig.tsc.json --noEmit",
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="startLive">
|
||||
单次直播
|
||||
</button>
|
||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="obsLive">
|
||||
obs推流
|
||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="obsLive">
|
||||
OBS 推流
|
||||
</button>
|
||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="stopLive">
|
||||
<button v-if="!isDir && isVideoFile(name)" class="live-button" @click="stopLive">
|
||||
停止直播
|
||||
</button>
|
||||
|
||||
@@ -386,7 +386,7 @@ const stopLive = async () => {
|
||||
const thread_id = props.url.replace(/\//g, "_");
|
||||
|
||||
// 调用 FastAPI 停止接口
|
||||
const res = await fetch("http://live.local:8700/stop_live", {
|
||||
const res = await fetch("http://192.168.31.103:8700/stop_live", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ thread_id }) // 如果想停止全部可以 body: {}
|
||||
@@ -414,7 +414,7 @@ const loopLive = async () => {
|
||||
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.103:8700/loop_Live", {
|
||||
// const res = await fetch("http://192.168.31.245:8700/start_live", {
|
||||
|
||||
method: "POST",
|
||||
@@ -436,8 +436,33 @@ const loopLive = async () => {
|
||||
};
|
||||
|
||||
const obsLive = async () => {
|
||||
try {
|
||||
// props.url 是 FileBrowser 内部路径,例如 /videos/test.mp4
|
||||
const file_path = props.url;
|
||||
// const file_path = encodeURIComponent(props.url);
|
||||
|
||||
console.log('file_path for OBS:', file_path);
|
||||
|
||||
// 这里模拟 OBS 推流逻辑,你可以根据实际后端接口来调整
|
||||
const res = await fetch("http://192.168.31.103:8700/obs_live", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ filename: file_path })
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.status === "ok") {
|
||||
alert(`OBS 推流已启动: ${file_path}`);
|
||||
} else {
|
||||
alert(`OBS 推流失败: ${data.msg}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
alert("OBS 推流接口调用失败,请检查后端服务是否启动");
|
||||
}
|
||||
};
|
||||
|
||||
const startLive = async () => {
|
||||
try {
|
||||
// props.url 是 FileBrowser 内部路径,例如 /videos/test.mp4
|
||||
@@ -446,7 +471,7 @@ const startLive = async () => {
|
||||
console.log('file_path',file_path)
|
||||
|
||||
// 调用 FastAPI 后端接口
|
||||
const res = await fetch("http://live.local:8700/start_live", {
|
||||
const res = await fetch("http://192.168.31.103:8700/start_live", {
|
||||
// const res = await fetch("http://192.168.31.245:8700/start_live", {
|
||||
|
||||
method: "POST",
|
||||
@@ -466,7 +491,6 @@ const startLive = async () => {
|
||||
alert("直播接口调用失败,请检查后端服务是否启动");
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user