Commit 3d48234a authored by wjf's avatar wjf

l

parents c074f988 9c9474bf
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"engineVersion": "5.2.7",
"compilerVersion": "5.2.7",
"engineVersion": "5.2.33",
"compilerVersion": "5.2.33",
"template": {},
"target": {
"current": "web"
......
......@@ -17,7 +17,6 @@ interface appContent {
type: number,
appIcon: string
}
class MyAdvideo {
el: any;
player: AdVideo;
......@@ -34,6 +33,7 @@ class MyAdvideo {
stragegyFn: any;
appContent: appContent;
isPlayEnd: boolean;
isPlaying: boolean;
constructor(config) {
this.el = config.el;
this._times = {
......@@ -80,6 +80,7 @@ class MyAdvideo {
// 请求完成
initListener() {
// 页面不可见
document.addEventListener('visibilitychange', () => {
// 用户离开了当前页面
if (document.visibilityState === 'hidden') {
......@@ -91,10 +92,11 @@ class MyAdvideo {
}
});
this.player.on('play', () => {
this._times._readyTime = +new Date();
this._times.duration = this.player.$video.duration
this.stragegyFn[this.strategy].report.videoLoad(this.videoRaw, this._times);
if (this.player.$video.currentTime === 0) {
this.isPlaying = true;
this._times._readyTime = +new Date();
this.stragegyFn[this.strategy].report.videoLoad(this.videoRaw, this._times);
this._times._showTime = +new Date();
this.stragegyFn[this.strategy].report.videoPlayStart(this.videoRaw, this._times);
}
......@@ -124,11 +126,13 @@ class MyAdvideo {
}
});
this.player.on('ended', () => {
this.isPlaying = false;
this.stragegyFn[this.strategy].report.videoPlayEnd(this.videoRaw, this._times);
this.isPlayEnd = true;
this.playResolve();
});
this.player.on('$videoClose', () => {
this.isPlaying = false;
this.stragegyFn[this.strategy].report.videoClose(this.videoRaw, this._times);
this.isVideoIng = false;
this.hide();
......
......@@ -7,6 +7,17 @@ import MyAdvideo from "../adVideo/adVideo";
import { stopBg, playBg } from "../soundCtrl";
let videoIns: MyAdvideo;
let videoContanier = document.querySelector('#video-contanier');
window['playingVideoClose'] = () => {
if (videoIns && videoIns.isPlaying) {
videoIns.isPlaying = false;
videoIns.hide();
videoIns.player.$video.src = '';
videoIns.isVideoIng = false;
playBg();
return '0';
}
return '1';
}
export const handleVideo = (
returnCallback: (s: boolean) => void,
completeCallback: Function,
......
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