Commit a364f66a authored by sujie@126.com's avatar sujie@126.com

dd

parent 3d633259
......@@ -147,6 +147,17 @@ function gifvideoPoster (src, params) {
}
return _src
}
function jpgvideoPoster (src, params) {
if (!src) return '';
var _src = src;
if (src.indexOf('media.shangjiadao.cn') == -1) {
_src = 'https://media.shangjiadao.cn/' + src + '.jpg';
}
if (params) {
_src = _src + '?x-oss-process=' + params;
}
return _src
}
function nameSplice (name, length) {
var _length = length || 4;
var _name = name || '';
......@@ -370,6 +381,17 @@ function timeCount(num){
s = s<10? '0' + s: s;
return m+':'+s
}
function isLoadVideo(index, current, length){
if(index == current) {
return true;
}
// if(current == length-1 && index == 0) {
// return true;
// }
// if(current == 0 && index == length-1) {
// return true;
// }
}
module.exports = {
formatDate: formatDate,
timeCompare: timeCompare,
......@@ -402,5 +424,7 @@ module.exports = {
checkSelectObj: checkSelectObj,
dateTimeCompare: dateTimeCompare,
stareCalculate: stareCalculate,
timeCount: timeCount
timeCount: timeCount,
jpgvideoPoster: jpgvideoPoster,
isLoadVideo: isLoadVideo,
}
\ No newline at end of file
......@@ -340,10 +340,7 @@ Page({
this.innerAudioContext.pause();
this.resetAudiosPlayStatus()
clearInterval(this.data.voiceInterval);
// this.didAnimation();
// clearInterval(this.timer);
this.setData({
// advertisementshow: false,
activitybarloaded: false
})
},
......@@ -355,8 +352,6 @@ Page({
}
})
clearInterval(this.data.voiceInterval);
// clearInterval(this.timer);
// this.didAnimation();
this.setData({
advertisementshow: false,
activitybarloaded: false
......
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<video src="{{filter.transformOssVideofy(video)}}" poster="{{filter.videoPoster(video)}}"></video>
<video src="{{filter.transformOssVideofyM3u8(video)}}" poster="{{filter.videoPoster(video)}}"></video>
</view>
\ No newline at end of file
.container video {
position:absolute;
/* position:absolute;
width:100%;
height:100%;
height:100%; */
}
\ No newline at end of file
......@@ -131,28 +131,6 @@ Page({
this.clockListGet();
const myLocation = LocalStorage.getItem('myLocation');
const that = this;
// if (myLocation) {
// this.setData({
// latitude: Number(myLocation.split('-')[0]),
// longitude: Number(myLocation.split('-')[1]),
// })
// } else {
// wx.getLocation({
// type: 'wgs84',
// success(res) {
// const {
// latitude,
// longitude
// } = res;
// LocalStorage.setItem('myLocation', latitude + '-' + longitude)
// that.setData({
// latitude: latitude,
// longitude: longitude,
// })
// }
// })
// }
wx.login({
success(res) {
const sessionCode = res.code;
......
......@@ -596,6 +596,11 @@ Page({
const _currentIndex = this.data.currentIndex;
const _innerCurrent = this.data.innerCurrent
this.data.preVideoId = this.data.currentVideoId;
if (_playList[current].type == 2) {
wx.showLoading({
title: '加载中',
})
}
if( this.data.preVideoId ){
this.videoContext = wx.createVideoContext(this.data.preVideoId);
this.videoContext.stop();
......@@ -603,11 +608,6 @@ Page({
this.data.currentVideoId = "video" + current;
this.videoContext = wx.createVideoContext(this.data.currentVideoId);
this.videoContext.play();
// }
if (_playList[current].type == 2) {
// var videoContext = wx.createVideoContext("video" + (current))
// videoContext.play();
}
this.setData({
[`innerCurrent[${current}]`]:_innerCurrent[current]?_innerCurrent[current]:0,
currentIndex: current,
......@@ -656,6 +656,9 @@ Page({
currentPlayItem: data.list[_currentInit]
}, () => {
if(this.data.currentPlayItem.type==2){
wx.showLoading({
title: '加载中',
})
this.data.currentVideoId = "video" + _currentInit;
this.videoContext = wx.createVideoContext(this.data.currentVideoId);
this.videoContext.play();
......@@ -743,6 +746,13 @@ Page({
clickVideo(e){
const id = e.currentTarget.dataset.id;
var videoContext = wx.createVideoContext(this.data.currentVideoId);
this.data.videoStatus[id] = {
isplay: this.data.videoStatus[id].isplay || false,
isClick:true
}
this.setData({
videoStatus:this.data.videoStatus
})
if(this.data.videoStatus[id].isplay){
videoContext.pause();
}else{
......@@ -752,10 +762,10 @@ Page({
bindplay(e){
const id = e.currentTarget.dataset.id;
const _id = 'video'+this.data.currentIndex;
console.log(id,_id)
if(id==_id){
this.data.videoStatus[id] = {
isplay:true
isplay:true,
isClick: this.data.videoStatus[id] ? (this.data.videoStatus[id].isClick || false) : false
}
this.setData({
videoStatus:this.data.videoStatus
......@@ -764,13 +774,14 @@ Page({
var videoContext = wx.createVideoContext(id);
videoContext.stop();
this.data.videoStatus[id] = {
isplay:false
isplay:false,
isClick: this.data.videoStatus[id] ? (this.data.videoStatus[id].isClick || false) : false
}
this.setData({
videoStatus:this.data.videoStatus
})
}
setTimeout(()=>{wx.hideLoading()}, 500);
},
bindpause(e){
......
......@@ -9,11 +9,13 @@
<swiper indicator-dots="{{false}}" show-fullscreen-btn="{{false}}" show-play-btn="false" style="height:100vh" vertical="{{true}}" circular="{{true}}" bindchange="playSwiperChange" current="{{currentInit}}" data-item="{{playitem}}">
<block wx:for="{{playList}}" wx:for-index="playindex" wx:for-item="playitem" wx:key="{{playindex}}" style="position: relative">
<swiper-item>
<video src="{{filter.transformOssVideofyM3u8(filter.jsonParse(playitem.content))}}" bindplay="bindplay" bindpause="bindpause" loop="{{true}}" bindtap="clickVideo" show-play-btn="{{false}}" show-center-play-btn="{{false}}" controls="{{false}}" data-type="{{playitem.type}}" data-id="video{{playindex}}" id="video{{playindex}}" poster="{{filter.videoPoster(playitem.video)}}" autoplay="{{false}}" wx-if="{{playitem.type==2 && ((playindex == currentIndex) || (playindex+1 == currentIndex) || (playindex-1 == currentIndex))}}"></video>
<view class="video-play-icon-box" bindtap="clickVideo" data-type="{{playitem.type}}" data-id="video{{playindex}}" id="video{{playindex}}" poster="{{filter.videoPoster(playitem.video)}}" wx:if="{{playitem.type==2 &&!videoStatus['video'+playindex].isplay}}">
<image class="video-play-icon" src="{{imageRoot}}2c/websiteindex/bigplay.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<view class="video-box-wrapper" wx-if="{{playitem.type==2}}">
<video bindprogress="videoProgress" class="{{videoStatus['video'+currentIndex].isClick || videoStatus['video'+currentIndex].isplay ? 'show-video' : ''}}" src="{{filter.transformOssVideofyM3u8(filter.jsonParse(playitem.content))}}" bindplay="bindplay" bindpause="bindpause" loop="{{true}}" bindtap="clickVideo" show-play-btn="{{false}}" show-center-play-btn="{{false}}" controls="{{false}}" data-type="{{playitem.type}}" data-id="video{{playindex}}" id="video{{playindex}}" poster="{{filter.videoPoster(playitem.video)}}" autoplay="{{false}}" wx-if="{{filter.isLoadVideo(playindex, currentIndex, playList.length)}}"></video>
<view class="video-play-icon-box" bindtap="clickVideo" data-type="{{playitem.type}}" data-id="video{{playindex}}" id="video{{playindex}}" poster="{{filter.videoPoster(playitem.video)}}" wx:if="{{playitem.type==2 &&!videoStatus['video'+playindex].isplay}}">
<image class="video-play-icon" src="{{imageRoot}}2c/websiteindex/bigplay.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
</view>
<image class="video-poster" src="{{filter.jpgvideoPoster(filter.jsonParse(playitem.content)[0], 'image/resize,w_400/format,jpg/quality,q_60')}}" mode="widthFix" lazy-load="false" binderror="" bindload="" />
</view>
<!-- <video src="{{filter.transformOssVideofy(filter.jsonParse(playitem.content))}}" data-id="video{{playindex}}" id="video{{playindex}}" poster="{{filter.videoPoster(playitem.video)}}" wx-if="{{playitem.type==2}}"></video> -->
<swiper indicator-dots="{{false}}" current="{{innerCurrent[playindex]?innerCurrent[playindex]:0}}" bindchange="innerCurrentChange" style="height:100vh;" wx:if="{{playitem.type==1}}" data-index="{{playindex}}">
<block wx:for="{{filter.jsonParse(playitem.content)}}" wx:key="{{index}}">
<swiper-item>
......
......@@ -96,6 +96,9 @@
.container video {
width: 100%;
height: 100%;
position: absolute;
left: -1000px;
top: 0;
}
.container .swiper-box {
......@@ -875,4 +878,18 @@
width: 102rpx;
height: 116rpx;
display: block;
}
.video-poster{
width: 100%;
}
.video-box-wrapper{
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 1);
}
.container .show-video {
left: 0;
}
\ No newline at end of file
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