创建flv组件
<template>
<video id="myvideo" @click="click" controls muted autoPlay disablePictureInPicture></video>
</template>
<script>
import flv from "flv.js";
export default {
name: "FlvVideo",
data() {
return {
player: null,
playing: false
};
},
props: {
hasAudio: {
type: Boolean,
default: false
},
isLive: {
type: Boolean,
default: true
},
url: {
require: true,
type: String
}
},
created() {
if (flv.isSupported()) {
this.player = flv.createPlayer({
type: "flv",
isLive: this.isLive,
hasAudio: this.hasAudio,
url: this.url // http://1011.hlsplay.aodianyun.com/demo/game.flv
});
}
},
mounted() {
var video = document.querySelector("#myvideo");
this.player.attachMediaElement(video);
this.player.load();
},
methods: {
click() {
if (this.playing) {
this.player.pause();
this.playing = false;
} else {
this.player.play();
this.playing = true;
}
}
}
};
</script>
<style>
#myvideo {
width: 100%;
height: 100%;
}
</style>
引用flv组件(引用组件就简单写一写,懂vue的都知道如何引入)
接下来就是白嫖斗鱼的直播源了,首先打开斗鱼,找到一家你想要的白嫖的地址
1、首先f12打开控制台,找到蓝条最长的
如果这里没有,那就打开ws
2、拿到地址,红框中的3637778raLSXdOdu(下播再开播后就不一样了)去掉_后的900(这个900是清晰度,筒子们可以用4000替换为高清晰度)
3、在vue引用组件中替换url,http://dyscdnali1.douyucdn.cn/live/xxxx_yyy.flv(xxxx是拿到的地址,yyy是清晰度)
<FlvVideo url="http://dyscdnali1.douyucdn.cn/live/3637778raLSXdOdu_4000.flv"/>
注:本文章是为了找到一个可播放的flv直播源,如有侵权,联系本人删除