js——视播放器模板

该博客介绍了如何利用JS来创建一个视频播放器模板。提供了模型样式的演示链接,并提到了关键的JS文件Player.js的引入方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

模型样式:https://demo.easyweb.vip/iframe/

js方法:


<h1>播放器</h1>
<hr />
<div style="padding: 5px;">
    <div id="demoVideo"></div>
</div>
@section Scripts{
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/js/Player.js"></script>
    <script>
        $(function () {
            // 开启弹幕
            var dmStyle = {
                color: '#ffcd08',
                fontSize: '25px'
            };

            var dmStyle2 = {
                color: '#EE0000',
                fontSize: '220px'
            };
            var player = new Player({
                id: "demoVideo",
                url: "/Content/video/4.mp4",  // 视频地址
                poster: "https://imgcache.qq.com/open_proj/proj_qcloud_v2/gateway/solution/general-video/css/img/scene/1.png",  // 封面
                fluid: true,  // 宽度100%
                autoplay: true,
                playbackRate: [0.5, 1, 1.5, 2, 3, 5, 10],  // 开启倍速播放
                pip: true,  // 开启画中画
                lang: 'zh-cn',
                danmu: {
                    comments: [
                        { id: '1', start: 0, txt: '前方高能', color: true, style: dmStyle, duration: 1000 },
                        { id: '2', start: 3500, txt: '666', color: true, style: dmStyle2, duration: 3000 },
                        { id: '3', start: 3500, txt: '弹幕护体', color: true, style: dmStyle, duration: 15000 },
                        { id: '4', start: 4500, txt: '弹幕护体', color: true, style: dmStyle, duration: 15000 },
                        { id: '5', start: 3500, txt: '前方高能111', color: true, style: dmStyle, duration: 15000 },
                        { id: '6', start: 8500, txt: '弹幕护体', color: true, style: dmStyle, duration: 15000 },
                        { id: '7', start: 10000, txt: '666666666', color: true, style: dmStyle, duration: 15000 },
                        { id: '8', start: 12500, txt: '前方高能', color: true, style: dmStyle, duration: 15000 },
                        { id: '9', start: 15500, txt: '666666666', color: true, style: dmStyle, duration: 15000 },
                        { id: '10', start: 16500, txt: '666666666', color: true, style: dmStyle, duration: 15000 },
                        { id: '11', start: 18000, txt: '关弹幕,保智商', color: true, style: dmStyle, duration: 15000 },
                        { id: '12', start: 20500, txt: '关弹幕,保智商', color: true, style: dmStyle, duration: 15000 },
                        { id: '13', start: 22000, txt: '666666666', color: true, style: dmStyle, duration: 15000 },
                        { id: '14', start: 25500, txt: '666666666', color: true, style: dmStyle, duration: 15000 },
                        { id: '15', start: 26000, txt: '前方高能', color: true, style: dmStyle, duration: 15000 }
                    ]
                }
            });
        });
    </script>
}

引入js文件:Player.js

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值