其他分享
首页 > 其他分享> > Html5选择本地视频音频文件播放

Html5选择本地视频音频文件播放

作者:互联网

原文链接:http://www.cnblogs.com/CielWater/p/4255946.html
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../Script/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#File").change(function (file) {
                $("body").append(file.target.files[0]);
                var url = window.URL.createObjectURL(file.target.files[0]);
                $("#player")[0].src = url;
                $("#player")[0].onload = function () {
                    window.URL.revokeObjectURL(src);
                };
                $("#player").css({ "width": "100%", "height": "100%" });
            });
        });
    </script>
</head>
<body>
    <input id="File" type="file" id="file" />
    <video id="player"autoplay="autoplay">
                    </video>
</body>
</html>

 

转载于:https://www.cnblogs.com/CielWater/p/4255946.html

标签:function,www,CielWater,音频文件,player,window,Html5,file,播放
来源: https://blog.csdn.net/weixin_30716725/article/details/97130140