dlxj commited on
Commit
d9223a7
·
1 Parent(s): d39d0c7

好像播放不了本地视频

Browse files
Files changed (2) hide show
  1. package.json +1 -1
  2. readme.txt +20 -0
package.json CHANGED
@@ -4,7 +4,7 @@
4
  "description": "[![HTML5](https://img.shields.io/badge/HTML5-E34F26?style=flat-square&logo=html5&logoColor=white)](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5) [![CSS3](https://img.shields.io/badge/CSS3-1572B6?style=flat-square&logo=css3&logoColor=white)](https://developer.mozilla.org/en-US/docs/Web/CSS) [![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=flat-square&logo=javascript&logoColor=black)](https://developer.mozilla.org/en-US/docs/Web/JavaScript) [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-blue?style=flat-square)](LICENSE) [![Open Source](https://img.shields.io/badge/Open%20Source-Yes-brightgreen?style=flat-square)]() [![Responsive](https://img.shields.io/badge/Responsive-Yes-blue?style=flat-square)]() [![Multi-Platform](https://img.shields.io/badge/Multi--Platform-Yes-blueviolet?style=flat-square)]() [![Web App](https://img.shields.io/badge/Web%20App-Yes-orange?style=flat-square)]()",
5
  "main": "core.js",
6
  "scripts": {
7
- "start": "node server.js",
8
  "test": "echo \"Error: no test specified\" && exit 1"
9
  },
10
  "repository": {
 
4
  "description": "[![HTML5](https://img.shields.io/badge/HTML5-E34F26?style=flat-square&logo=html5&logoColor=white)](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5) [![CSS3](https://img.shields.io/badge/CSS3-1572B6?style=flat-square&logo=css3&logoColor=white)](https://developer.mozilla.org/en-US/docs/Web/CSS) [![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=flat-square&logo=javascript&logoColor=black)](https://developer.mozilla.org/en-US/docs/Web/JavaScript) [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-blue?style=flat-square)](LICENSE) [![Open Source](https://img.shields.io/badge/Open%20Source-Yes-brightgreen?style=flat-square)]() [![Responsive](https://img.shields.io/badge/Responsive-Yes-blue?style=flat-square)]() [![Multi-Platform](https://img.shields.io/badge/Multi--Platform-Yes-blueviolet?style=flat-square)]() [![Web App](https://img.shields.io/badge/Web%20App-Yes-orange?style=flat-square)]()",
5
  "main": "core.js",
6
  "scripts": {
7
+ "dev": "node server.js",
8
  "test": "echo \"Error: no test specified\" && exit 1"
9
  },
10
  "repository": {
readme.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `e:\huggingface_echodict\IPTV-Web-Player\core.js#L27-27` 如果这里传一个本地文件 `e:\huggingface_echodict\IPTV-Web-Player\TempVideo\segment_000.ts` 能成功吗?只分析问题,不要改任何代码
2
+
3
+ 不能成功 。
4
+
5
+ 如果在这个位置传入本地绝对路径 e:\huggingface_echodict\IPTV-Web-Player\TempVideo\segment_000.ts ,会导致以下问题:
6
+
7
+ ### 1. 浏览器安全限制(主要原因)
8
+ 由于你的网页是通过 http://localhost:3000 运行的,浏览器出于安全策略(同源策略和本地文件访问限制),禁止网页直接通过 file:// 协议访问本地硬盘上的文件。
9
+
10
+ - 现象 :控制台会报错 Not allowed to load local resource: file:///e:/... 。
11
+ ### 2. HLS.js 的设计用途
12
+ hls.js 库(代码中的 Hls 对象)专门用于播放 HLS 流媒体协议 (即 .m3u8 索引文件)。
13
+
14
+ - 格式不匹配 :你传入的是一个 .ts 视频分片文件,而不是 .m3u8 播放列表。 hls.loadSource() 期望加载的是一个包含分片信息的文本索引文件,它无法直接解码并播放单个 .ts 二进制文件。
15
+ - 正确用法 :应该传入一个 .m3u8 的 URL(例如 http://localhost:3000/TempVideo/playlist.m3u8 ),该 m3u8 文件内部引用了 segment_000.ts 。
16
+ ### 3. URL 格式错误
17
+ hls.loadSource() 期望接收的是一个有效的 URL 字符串(如 http://... 或 https://... )。Windows 风格的本地路径( e:\... )在 Web 环境下不是一个合法的网络资源地址。
18
+
19
+ 结论 :
20
+ 你需要通过 Web 服务器的 URL 来访问资源,并且目标必须是 .m3u8 文件,而不是本地路径的 .ts 文件。