forked from fuyi501/web-video-live
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<video id="videoElement2" style="background-color:#fff;height:300px;width:100%;"></video> | ||
</template> | ||
|
||
<script> | ||
import flvjs from 'flv.js' | ||
export default { | ||
name: 'flvjs', // 不能使用 video 命名 | ||
props: { | ||
src: { | ||
type: String, | ||
default: 'http://cyberplayerplay.kaywang.cn/cyberplayer/demo201711-L1.flv' | ||
// default: 'http://192.168.9.12:8080/live?app=live&stream=stream' | ||
} | ||
}, | ||
data () { | ||
return { | ||
} | ||
}, | ||
mounted () { | ||
let flvSrc = this.src | ||
console.log('flvSrc:', flvSrc) | ||
if (flvjs.isSupported()) { | ||
var videoElement = document.getElementById('videoElement2') | ||
var flvPlayer = flvjs.createPlayer({ | ||
type: 'flv', | ||
// url: 'http://yunxianchang.live.ujne7.com/vod-system-bj/TLaf2cc9d469939803949187b46da16c45.flv' | ||
url: flvSrc | ||
}) | ||
flvPlayer.attachMediaElement(videoElement) | ||
flvPlayer.load() | ||
flvPlayer.play() | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters