Page({
data: {
url: 'http://183.56.149.27/vhot2.qqvideo.tc.qq.com/A-aSuPQ2kL0oTeaLLAzX4JDIsc0rjb9G7dY5AYgtEtHY/p0695s87sjw.mp4?sdtfrom=v1010&guid=84bd1b079f916dc8aeb403bb38aeeda4&vkey=D3E47BA1117752D7801052EF47C846DFE72CDFD66A0431CC1F41B8431129DEB73C334747045738B50E90DF8CE2E41110C45190AD77C5B340945AF17A73942DF3E132B8C974441BA0012EF3D7651C5783C14FDFF9327FCAE44B5E9CDA0A6776F52404EA1EFB876DD85D88E35FF83F76F2A3A462C93CDD3777' ,
videoheight:0,
flag: 0,
text: '' ,
},
handletouchmove: function (event){
if ( this .data.flag !== 0) {
return
}
let currentX = event.touches[0].pageX;
let currentY = event.touches[0].pageY;
let tx = currentX - this .data.lastX;
let ty = currentY - this .data.lastY;
let text = "" ;
if (Math.abs(tx) > Math.abs(ty)) {
if (tx < 0) {
text = "向左滑动" ;
this .data.flag = 1;
}
else if (tx > 0) {
text = "向右滑动" ;
this .data.flag = 2
}
}
else {
if (ty < 0) {
text = "向上滑动" ;
this .data.flag = 3
}
else if (ty > 0) {
text = "向下滑动" ;
this .data.flag = 4
}
}
console.log(text);
switch (text){
case '向上滑动' :
this .shang();
break ;
case '向下滑动' :
this .xia();
break ;
case '向左滑动' :
break ;
case '向右滑动' :
break ;
}
this .data.lastX = currentX;
this .data.lastY = currentY;
this .setData({
text: text,
});
},
handletouchstart: function (event){
this .data.lastX = event.touches[0].pageX;
this .data.lastY = event.touches[0].pageY;
},
handletouchend: function (event){
this .data.flag = 0
this .setData({
text: "没有滑动" ,
});
},
shang: function (){
console.log( 'shang' );
var that = this ;
var sl = setInterval( function (){
if (that.data.videoheight > -100){
that.setData({
videoheight: that.data.videoheight - 2
});
} else {
that.setData({
url: 'http://183.56.149.27/vhot2.qqvideo.tc.qq.com/A-aSuPQ2kL0oTeaLLAzX4JDIsc0rjb9G7dY5AYgtEtHY/p0695s87sjw.mp4?sdtfrom=v1010&guid=84bd1b079f916dc8aeb403bb38aeeda4&vkey=D3E47BA1117752D7801052EF47C846DFE72CDFD66A0431CC1F41B8431129DEB73C334747045738B50E90DF8CE2E41110C45190AD77C5B340945AF17A73942DF3E132B8C974441BA0012EF3D7651C5783C14FDFF9327FCAE44B5E9CDA0A6776F52404EA1EFB876DD85D88E35FF83F76F2A3A462C93CDD3777' ,
videoheight:0
});
clearInterval(sl);
}
},1);
},
xia: function () {
var that = this ;
var sl = setInterval( function () {
if (that.data.videoheight < 100) {
that.setData({
videoheight: that.data.videoheight + 2
});
} else {
that.setData({
url: 'http://183.56.149.27/vhot2.qqvideo.tc.qq.com/A-aSuPQ2kL0oTeaLLAzX4JDIsc0rjb9G7dY5AYgtEtHY/p0695s87sjw.mp4?sdtfrom=v1010&guid=84bd1b079f916dc8aeb403bb38aeeda4&vkey=D3E47BA1117752D7801052EF47C846DFE72CDFD66A0431CC1F41B8431129DEB73C334747045738B50E90DF8CE2E41110C45190AD77C5B340945AF17A73942DF3E132B8C974441BA0012EF3D7651C5783C14FDFF9327FCAE44B5E9CDA0A6776F52404EA1EFB876DD85D88E35FF83F76F2A3A462C93CDD3777' ,
videoheight: 0
});
clearInterval(sl);
}
}, 1);
},
onLoad: function (options) {
},
onReady: function () {
},
onShow: function () {
},
onHide: function () {
},
onUnload: function () {
},
onPullDownRefresh: function () {
},
onReachBottom: function () {
},
onShareAppMessage: function () {
}
})
|
坐等官网回答
你好~请问是哪个小程序,我体验下
你可以通过canvas来操作video....我目前就是给canvas加touch事件,是可以的
canvas里面嵌套video吗?
都可以那, canvas的层级比video高
你好,你实现了,方便加微信交流下不,18758580307,请教下视频的 滑动效果,可以有偿哈
声音的话要怎么解决
你好,请问你这个问题解决了么?怎么解决的