xqq / mpegts.js

HTML5 MPEG2-TS / FLV Stream Player
Apache License 2.0
1.72k stars 217 forks source link

我是小白,安装出现了问题求解 #6

Closed shuilingw closed 3 years ago

shuilingw commented 3 years ago

我安装了node.js后,mpegts.js-master文件夹放在桌面,用cmd输入以下指令: npm install --save mpegts.js,出现 image npm install ,出现 image npm install -g webpack-cli ,出现 image npm run build,出现 image 这个安装顺序有问题吗?还有想问一下

Getting Started


<script src="mpegts.js"></script>
<video id="videoElement"></video>
<script>
    if (mpegts.getFeatureList().mseLivePlayback) {
        var videoElement = document.getElementById('videoElement');
        var player = mpegts.createPlayer({
            type: 'mse',  // could also be mpegts, m2ts, flv
            isLive: true,
            url: 'http://example.com/live/livestream.ts'
        });
        player.attachMediaElement(videoElement);
        player.load();
        player.play();
    }
</script>
这段代码怎么用,本人第一次接触javascript,求解,感谢!
shuilingw commented 3 years ago

我是win10的系统

shuilingw commented 3 years ago

现在前面几步都没问题了,卡在了这里 image

shuilingw commented 3 years ago

npm run build 安装完了,请问怎么用下面这个

Getting Started


<script src="mpegts.js"></script>
<video id="videoElement"></video>
<script>
    if (mpegts.getFeatureList().mseLivePlayback) {
        var videoElement = document.getElementById('videoElement');
        var player = mpegts.createPlayer({
            type: 'mse',  // could also be mpegts, m2ts, flv
            isLive: true,
            url: 'http://example.com/live/livestream.ts'
        });
        player.attachMediaElement(videoElement);
        player.load();
        player.play();
    }
</script>

比如我想看下面这个直播源应该怎么操作
https://aldirect.hls.huya.com/huyalive/1448118938-1448118938-6219623479428251648-100209664-10057-A-0-1.m3u8?wsSecret=270476d335859b671c5d04f439b5cfc5&wsTime=60b743da&u=0&seqid=16225367929936164&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=tars_mobile&txyp=o%3Anc2%3B&fs=bgct&t=103'