Skip to content

Commit

Permalink
changed slot to be always visible to allow VPAID's detect visibilty o…
Browse files Browse the repository at this point in the history
…n initAd, hide/show video slot instead
  • Loading branch information
Basil Goldman committed Mar 26, 2023
1 parent ebca255 commit 4c682ee
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/ads-manager.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ads-manager.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ads-manager",
"version": "1.2.10",
"version": "1.2.11",
"description": "HTML5 Video Ads Manager based on @dailymotion/vast-client",
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
2 changes: 1 addition & 1 deletion public/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>Ads Manager</title>
<title></title>
</head>
<body>

Expand Down
12 changes: 12 additions & 0 deletions public/iframe2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>

<iframe src="iframe.html" width="100%" height="600px"></iframe>

</body>
</html>
6 changes: 3 additions & 3 deletions public/js/ads-manager.js

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions src/ads-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ AdsManager.prototype.createSlot = function() {
console.log('create slot......');
this._slot = document.createElement('div');
this._slot.style.position = 'absolute';
this._slot.style.display = 'none';
//this._slot.style.display = 'none';
this._adContainer.appendChild(this._slot);
this.createVideoSlot();
};
Expand Down Expand Up @@ -218,12 +218,16 @@ AdsManager.prototype.createVideoSlot = function() {
this._videoSlot.style.width = '100%';
this._videoSlot.style.height = '100%';
this._videoSlot.style.backgroundColor = 'rgb(0, 0, 0)';
this._videoSlot.style.display = 'none';
//this._adContainer.appendChild(this._videoSlot);
this._slot.appendChild(this._videoSlot);
};
AdsManager.prototype.hideVideoSlot = function() {
this._videoSlot.style.display = 'none';
};
AdsManager.prototype.showVideoSlot = function() {
this._videoSlot.style.display = 'block';
};
AdsManager.prototype.stopVASTMediaLoadTimeout = function() {
if(this._vastMediaLoadTimer) {
clearTimeout(this._vastMediaLoadTimer);
Expand Down Expand Up @@ -303,7 +307,12 @@ AdsManager.prototype.onAdSizeChange = function() {
AdsManager.prototype.onAdStarted = function() {
this._hasStarted = true;
// Show ad slot
this.showSlot();
//this.showSlot();
if(this._videoSlot.src === '') {
this.hideVideoSlot();
} else {
this.showVideoSlot();
}
this._callEvent(this.EVENTS.AdStarted);
};
AdsManager.prototype.onAdVideoStart = function() {
Expand Down Expand Up @@ -1164,7 +1173,8 @@ AdsManager.prototype.abort = function() {
this._videoSlot.load();

// Hide slot
this.hideSlot();
//this.hideSlot();
this.hideVideoSlot();

};
AdsManager.prototype.destroy = function() {
Expand Down

0 comments on commit 4c682ee

Please sign in to comment.