预览加入h265和mp3的解码支持

This commit is contained in:
李宇翔
2020-02-24 11:56:25 +08:00
parent 66a396df0b
commit 620d96b39c
5 changed files with 108 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -9,8 +9,8 @@
>
<canvas id="canvas" width="488" height="275" style="background: black" />
<div slot="footer">
<!-- 音频缓冲-->
<!-- <InputNumber v-model="audioBuffer" size="small"></InputNumber>-->
<!-- 音频缓冲-->
<!-- <InputNumber v-model="audioBuffer" size="small"></InputNumber>-->
<Button v-if="audioEnabled" @click="turnOff" icon="md-volume-off" />
<Button v-else @click="turnOn" icon="md-volume-up"></Button>
</div>
@@ -21,26 +21,49 @@
let h5lc = null;
export default {
name: "Jessibuca",
props: {
audioCodec: String,
videoCodec: String
},
data() {
return {
audioEnabled: false,
// audioBuffer: 12,
url: ""
url: "",
decoderTable: {
AAC_AVC: "ff",
AAC_H265: "hevc_aac",
MP3_AVC: "ff_mp3",
MP3_H265: "hevc_mp3"
}
};
},
watch: {
audioEnabled(value) {
h5lc.audioEnabled(value);
},
// audioBuffer(v) {
// h5lc.audioBuffer = v;
// }
decoder(value) {
if (h5lc) {
h5lc.destroy();
}
h5lc = new window.Jessibuca({
canvas: document.getElementById("canvas"),
decoder: value
});
}
},
computed: {
decoder() {
return (
"jessibuca/" +
this.decoderTable[this.audioCodec + "_" + this.videoCodec] +
".js"
);
}
},
mounted() {
h5lc = new window.Jessibuca({
canvas: document.getElementById("canvas"),
decoder: "jessibuca/ff.js",
audioBuffer: this.audioBuffer
decoder: "jessibuca/ff.js"
});
},
destroyed() {

View File

@@ -181,8 +181,14 @@ export default {
return item.SubscriberInfo ? item.SubscriberInfo.length : 0;
},
preview(item) {
this.$refs.jessibuca.play(
"ws://" + location.hostname + ":8080/" + item.StreamPath
this.$refs.jessibuca.videoCodec = this.CodecID(item.VideoInfo.CodecID);
this.$refs.jessibuca.audioCodec = this.SoundFormat(
item.AudioInfo.SoundFormat
);
this.$nextTick(() =>
this.$refs.jessibuca.play(
"ws://" + location.hostname + ":8080/" + item.StreamPath
)
);
this.showPreview = true;
},