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


<!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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM