MoePlayer / hexo-tag-dplayer

Embed dplayer in Hexo posts/pages
MIT License
210 stars 30 forks source link

调用本地视频(即localhost:4000访问)时无法调节视频进度 #24

Closed CCJohny closed 6 years ago

CCJohny commented 6 years ago

当我点击进度条任意位置时都会跳回第一秒

CCJohny commented 6 years ago

是本地资源不支持断点续传吗还是

dixyes commented 6 years ago

你可以试着直接用浏览器打开这个文件

DIYgod commented 6 years ago

本地文件不支持

dixyes commented 6 years ago

@DIYgod 我猜他说的是hexo自带的预览模式 http://localhost:4000/somePath/someFile.mp4 这种算是本地么

(最近沉迷做python的coolq嵌入 沉迷的不行都没看邮件。。。

DIYgod commented 6 years ago

@dixyes 应该也算

A-Circle-Zhang commented 6 years ago

localhost 也是一种本地服务器,对浏览器而言,和网络服务器没任何区别。

我觉得这个问题是要看本地服务器支不支持 Range 。

dixyes commented 6 years ago

emmm 好像是hexo的锅

>C:\Users\DIXXPS\Desktop\pycompact>curl http://localhost:4000/blog/x.mp4 -H"Range: bytes=1000-1012" -vvv --output -
*   Trying ::1...
* TCP_NODELAY set
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 4000 (#0)
> GET /blog/x.mp4 HTTP/1.1
> Host: localhost:4000
> User-Agent: curl/7.55.1
> Accept: */*
> Range: bytes=1000-1012
>
< HTTP/1.1 200 OK
< X-Powered-By: Hexo
< Content-Type: video/mp4
< Date: Fri, 31 Aug 2018 14:31:15 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
<
(一坨乱码二进制) * Failed writing body (4096 != 16384)
* Failed writing data
* Closing connection 0
curl: (23) Failed writing body (4096 != 16384)

http-server的正确响应:

C:\Users\DIXXPS\Desktop\pycompact>curl http://localhost/x.mp4 -H"Range: bytes=1000-1012" -vvv --output -
*   Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 80 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /x.mp4 HTTP/1.1
> Host: localhost
> User-Agent: curl/7.55.1
> Accept: */*
> Range: bytes=1000-1012
>
< HTTP/1.1 206 Partial Content
< server: ecstatic-3.2.0
< Content-Range: bytes 1000-1012/173181126
< Accept-Ranges: bytes
< Content-Length: 13
< Content-Type: video/mp4; charset=utf-8
< cache-control: max-age=3600
< last-modified: Thu, 29 Jun 2017 10:49:04 GMT
< etag: W/"2814749767885134-173181126-"2017-06-29T10:49:04.000Z""
< Date: Fri, 31 Aug 2018 14:35:22 GMT
< Connection: keep-alive
<
    ?     * Connection #0 to host localhost left intact