Commit 55ca205b authored by Quxl's avatar Quxl

x

parent 0ccb4a5d
......@@ -31,7 +31,7 @@ body {
</head>
<body onkeydown="keydownProcess">
<div id="app">
<div class="prism-player" id="J_prismPlayer"></div>
<div class="prism-player" id="J_prismPlayer" @keydown=keydown></div>
<el-dialog :visible.sync="loginVisible" style="width:800px;margin:auto;"> <el-form> <el-form-item label="用户名:" label-width="75px"> <el-input v-model="loginForm.username" placeholder="请输入登陆名" style="width:85%;"></el-input> </el-form-item> <el-form-item label="密码:" label-width="75px"> <el-input type="password" v-model="loginForm.password" placeholder="请输入登陆密码" style="width:85%;"></el-input> </el-form-item> </el-form>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="loginVisible = false">关闭</el-button>
......@@ -57,36 +57,7 @@ body {
<script>
function keydownProcess(e) {
var keyNum= window.event ? e.keyCode : e.which;
console.log("keyCode=" + keyNum);
var xplayer = window.xplayer;
if(!xplayer) {
return;
}
if(keyNum=='32'){
var status = xplayer.getStatus();
if(status == 'play') {
xplayer.pause();
} else {
xplayer.play();
}
} else if(keyNum=='37'){//快进
var videotimes = xplayer.getDuration();
var playnum = xplayer.getCurrentTime();
playnum =parseInt(playnum-10);
if(playnum<=(videotimes-30)){
xplayer.seek(playnum);
}
} else if(keyNum=='39'){
var videotimes = xplayer.getDuration();
var playnum = xplayer.getCurrentTime();
playnum = parseInt(playnum +10);
if(playnum>15){
xplayer.seek(playnum);
} else{
xplayer.seek(0);
}
}
}
var vue = new Vue({
......@@ -114,7 +85,7 @@ body {
if(authJsonObject.code == 200) {
var vid = authJsonObject.vid;
var playAuth = authJsonObject.playAuth;
var xplayer = new Aliplayer({
this.xplayer = new Aliplayer({
id : "J_prismPlayer",
width : "100%",
height: "100%",
......@@ -123,7 +94,6 @@ body {
vid : vid,
playauth : playAuth
}, function(xplayer) {
window.xplayer = xplayer;
console.log("播放器创建好了。", xplayer)
});
} else if(authJsonObject.code == 300) {
......@@ -173,6 +143,38 @@ body {
}
});
},
keydown(e) {
var keyNum= window.event ? e.keyCode : e.which;
console.log("keyCode=" + keyNum);
var xplayer = this.xplayer;
if(!xplayer) {
return;
}
if(keyNum=='32'){
var status = xplayer.getStatus();
if(status == 'play') {
xplayer.pause();
} else {
xplayer.play();
}
} else if(keyNum=='37'){//快进
var videotimes = xplayer.getDuration();
var playnum = xplayer.getCurrentTime();
playnum =parseInt(playnum-10);
if(playnum<=(videotimes-30)){
xplayer.seek(playnum);
}
} else if(keyNum=='39'){
var videotimes = xplayer.getDuration();
var playnum = xplayer.getCurrentTime();
playnum = parseInt(playnum +10);
if(playnum>15){
xplayer.seek(playnum);
} else{
xplayer.seek(0);
}
}
}
},
mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment