BUI 视频,音频在线播放

直接贴代码

HTML代码:

             <audio src="pages/m.mp3" preload="auto" controls></audio>   //音频播放器
                <div id="video"> //视频播放器
                    <video id="my-video" class="video-js" controls preload="auto" width="330px" height="200px"     
                        data-setup="{}">
                        <source src="pages/m.mp4" type="video/mp4">
                        <!-- <source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
                    <source src="http://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">
                    <p class="vjs-no-js"> To view this video please enable JavaScript, and consider upgrading to a web
                        browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5
                            video</a> </p> -->
                    </video>
                </div>
 
 
Js代码:
 loader.import(["css/video-js.min.css", "js/video.min.js"], function () {
            var myPlayer = videojs('my-video');
            videojs("my-video").ready(function () {
                var myPlayer = this;
                myPlayer.play();
            })

        })
posted @ 2020-09-10 09:17  LUCKY-y  阅读(297)  评论(0编辑  收藏  举报