02 开发页面、配置并启动播放

在完成视频的切割之后,我们就可以借助nginx来播放处理好的视频集合。

1、环境约束

  • nginx-1.14.0 windows版本

2、操作步骤

  • 1 创建播放页面
    (1)在D盘下创建一个文件夹video/plugin,在该文件夹下拷贝video.js、videojs-contrib-hls.js以及video-js.css。
    (2)在D:/video文件夹下创建一个文件index.html,内容如下:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>视频播放</title>
    <link href="plugin/video-js.css" rel="stylesheet">
</head>
<body>
<video id=example-video width=800 height=600 class="video-js vjs-default-skin vjs-big-play-centered" controls>
    <source
            src="http://localhost/hls/wanho.m3u8"
            type="application/x-mpegURL">
</video>
<script src="plugin/video.js"></script>
<script src="plugin/videojs-contrib-hls.js"></script>
<script>
    var player = videojs('example-video');
    player.play();
</script>
</body>
</html>
  • 2 解压nginx压缩包,配置nginx.conf
    在http的server节点下加入以下内容
location /video {
    alias "D:/video/";
    index  index.html index.htm;
}
location /hls {
    alias "D:/ffmpeg-20190502-7eba264-win64-static/bin/hls/";
}
  • 3 启动nginx
    进入nginx文件夹的bin目录下,打开命令行,执行nginx.exe
  • 4 测试
    在浏览器中输入http://localhost/video/index.html,就能看到视频的播放。
    以上就是借助nginx访问第一小节分割的视频之过程。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值