HTML5视频源标记语法
当使用相对位置在网站中插入视频时,它相当简单:HTML5视频源标记语法,html,html5-video,Html,Html5 Video,当使用相对位置在网站中插入视频时,它相当简单: <source src="videos/video.mp4" type="video/mp4"/> 然而,我需要插入一个视频文件从一个完全不同的目录。 比如“C:\Some\Folder\onhedrive\videos” 但该项目位于:“C:\XAMPP\htdocs\projectname” 我也试过这些方法: <source src="file://C:\Some\Folder\onthedrive\videos\vi
<source src="videos/video.mp4" type="video/mp4"/>
然而,我需要插入一个视频文件从一个完全不同的目录。
比如“C:\Some\Folder\onhedrive\videos”
但该项目位于:“C:\XAMPP\htdocs\projectname”
我也试过这些方法:
<source src="file://C:\Some\Folder\onthedrive\videos\video.mp4" type="video/mp4"/>
<source src="file://C:/Some/Folder/onthedrive/videos/video.mp4" type="video/mp4"/>
我能做些什么来解决这个问题
编辑:
<source src="file://C:\Some\Folder\onthedrive\videos\video.mp4" type="video/mp4"/>
实际上,网络服务器和浏览器都能识别它,但出于安全考虑,其中一个决定不加载该文件
Chrome:“不允许加载本地资源”。您必须将“文件://”更改为“文件://”
为什么要三刀?
"file:///C:/etc“是的快捷方式”file://localhost/C:/etc"
你可以在这里找到它:
编辑:
我下载了w3schools在那里使用的视频,我的代码如下所示
<video width="400" controls>
<source src="file:///C:\Users\Gebruiker\Downloads\mov_bbb.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
您的浏览器不支持HTML5视频。
请确保更改url的路径。使其与文件树匹配尝试了'src='file:///C:/etc/video.mp4“,它不起作用。请尝试以下操作:
src=”file:///C:\Some\Folder\onthedrive\videos\video.mp4“
或尝试此src=”file:///C:/Some/Folder/onthedrive/videos/video.mp4“
(由于某些原因,我无法编辑以前的评论),但您必须在“file:///C:\“或”file:///C:/"