aboutsummaryrefslogtreecommitdiffstats
path: root/dist/plyr.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2019-01-26 16:31:47 +1100
committerSam Potts <sam@potts.es>2019-01-26 16:31:47 +1100
commitc44351507f0a06578a1fee10185117e7df64ece9 (patch)
tree9b7afe1e0378ce80e3efaadfe5fc7041926d68db /dist/plyr.js
parentc577eb01cea0cb2c742a8cbd10909f63b869cd4e (diff)
downloadplyr-c44351507f0a06578a1fee10185117e7df64ece9.tar.lz
plyr-c44351507f0a06578a1fee10185117e7df64ece9.tar.xz
plyr-c44351507f0a06578a1fee10185117e7df64ece9.zip
Plugin tweaks for ads and previews
Diffstat (limited to 'dist/plyr.js')
-rw-r--r--dist/plyr.js39
1 files changed, 31 insertions, 8 deletions
diff --git a/dist/plyr.js b/dist/plyr.js
index 23441f09..19b9d9da 100644
--- a/dist/plyr.js
+++ b/dist/plyr.js
@@ -3466,7 +3466,8 @@ typeof navigator === "object" && (function (global, factory) {
// Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
ads: {
enabled: false,
- publisherId: ''
+ publisherId: '',
+ tagUrl: ''
},
// YouTube nocookies mode
noCookie: false,
@@ -5970,7 +5971,7 @@ typeof navigator === "object" && (function (global, factory) {
_classCallCheck(this, Ads);
this.player = player;
- this.publisherId = player.config.ads.publisherId;
+ this.config = player.config.ads;
this.playing = false;
this.initialized = false;
this.elements = {
@@ -6037,7 +6038,7 @@ typeof navigator === "object" && (function (global, factory) {
this.listeners(); // Setup the IMA SDK
this.setupIMA();
- } // Build the default tag URL
+ } // Build the tag URL
}, {
key: "setupIMA",
@@ -6206,7 +6207,8 @@ typeof navigator === "object" && (function (global, factory) {
var container = this.player.elements.container; // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)
// don't have ad object associated
- var ad = event.getAd(); // Proxy event
+ var ad = event.getAd();
+ var adData = event.getAdData(); // Proxy event
var dispatchEvent = function dispatchEvent(type) {
var event = "ads".concat(type.replace(/_/g, '').toLowerCase());
@@ -6288,6 +6290,13 @@ typeof navigator === "object" && (function (global, factory) {
dispatchEvent(event.type);
break;
+ case google.ima.AdEvent.Type.LOG:
+ if (adData.adError) {
+ this.player.debug.warn("Non-fatal ad error: ".concat(adData.adError.getMessage()));
+ }
+
+ break;
+
default:
break;
}
@@ -6320,9 +6329,8 @@ typeof navigator === "object" && (function (global, factory) {
this.player.on('ended', function () {
_this8.loader.contentComplete();
});
- this.player.on('seeking', function () {
+ this.player.on('timeupdate', function () {
time = _this8.player.currentTime;
- return time;
});
this.player.on('seeked', function () {
var seekedTime = _this8.player.currentTime;
@@ -6540,11 +6548,18 @@ typeof navigator === "object" && (function (global, factory) {
}, {
key: "enabled",
get: function get() {
- return this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && !is.empty(this.publisherId);
+ var config = this.config;
+ return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is.empty(config.publisherId) || is.url(config.tagUrl));
}
}, {
key: "tagUrl",
get: function get() {
+ var config = this.config;
+
+ if (is.url(config.tagUrl)) {
+ return config.tagUrl;
+ }
+
var params = {
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
AV_CHANNELID: '5a0458dc28a06145e4519d21',
@@ -6860,12 +6875,20 @@ typeof navigator === "object" && (function (global, factory) {
this.toggleThumbContainer(true);
this.setThumbContainerSizeAndPos();
} // Find the desired thumbnail index
+ // TODO: Handle a video longer than the thumbs where thumbNum is null
var thumbNum = this.thumbnails[0].frames.findIndex(function (frame) {
return _this5.seekTime >= frame.startTime && _this5.seekTime <= frame.endTime;
});
- var qualityIndex = 0; // Check to see if we've already downloaded higher quality versions of this image
+ var hasThumb = thumbNum >= 0;
+ var qualityIndex = 0;
+ this.toggleThumbContainer(hasThumb); // No matching thumb found
+
+ if (!hasThumb) {
+ return;
+ } // Check to see if we've already downloaded higher quality versions of this image
+
this.thumbnails.forEach(function (thumbnail, index) {
if (_this5.loadedImages.includes(thumbnail.frames[thumbNum].text)) {