我正在尝试通过 API“input type='file' ”标签使用本地文件更改 HTML5 视频源。此 HTML 脚本旨在仅在本地运行,播放我的高清视频,但我无法获取“输入”标签来选择和播放我的高清视频文件。 jsfiddle 示例
超文本标记语言
<!----------------HOW to cahnge VID source Localy--------------------->
<p>working example</p>
<div id="selectFile">
<p>Change VID:
<br>
<button onclick="changeVID()">Change VID</button>
</div>
<div>
<video muted controls id="videoPlayer" >
<source id='currentVID' src="http://html5multimedia.com/code/ch9/media/elephants-dream-medium.mp4" type="video/mp4">
</video>
</div>
<!----------desired result--------------->
<br>
<div id="desired result" style="background-color:grey;">
<p>desired result</p>
<br>
<div id="selectFile">
<p>Change local VID:
<br>
<input id="newlocalFILE" name="localfile" size="50" maxlength="100000"
accept="text/*" type="file" onchange="playlocalVID();">
</div>
<div>
<video muted controls id="videoPlayer" >
<source id='currentVID' src="c:\LocalVID.mp4" type="video/mp4">
</video>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
脚本语言
/***********working …Run Code Online (Sandbox Code Playgroud)