< !DOCTYPE html > < html lang = "en" > < head >
< meta http‐equiv = "content‐type" content = "text/html; charset=utf‐8" / >
< title > 视频播放 < / title >
< link href = "/plugins/videojs/video‐js.css" rel = "stylesheet" > < / head > < body > < video id = example‐video width = 800 height = 600 class = "video‐js vjs‐default‐skin vjs‐big‐playcentered" controls poster = "http://127.0.0.1:90/video/add.jpg" >
< source
src = "http://video.xuecheng.com/video/hls/lucene.m3u8"
type = "application/x‐mpegURL" > < / video >
< input type = "button" onClick = "switchvideo()" value = "switch" / >
< script src = "/plugins/videojs/video.js" > < / script >
< script src = "/plugins/videojs/videojs‐contrib‐hls.js" > < / script > < script >
var player = videojs ( 'example‐video' ) ;
/ / player.play ( ) ; / / 切换视频
function switchvideo ( ) {
player.src ( {
src : 'http : / / video.xuecheng.com / video / hls / lucene.m 3 u 8 ' ,
type : ' application / x‐mpegURL' ,
withCredentials : true
|