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