@nlo/ping-video-loader
Advanced tools
Comparing version 0.0.1-alpha.85 to 0.0.1-alpha.88
import pingVideoLoader from './ping-video-loader'; | ||
export default pingVideoLoader; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,5 +1,14 @@ | ||
declare type WebplayerFunc = (elementId: string | null, widthStyle?: string | null, topStyle?: string | null, videoId?: string | null, scriptName?: string | null, // Extra VARS/HASH for video personalisation | ||
language?: 'Dutch' | 'English' | string | null, // = 'English' | ||
controlsBelowVideo?: boolean | null, // = false, which means it will appear overtop the video on hover | ||
autoStart?: boolean | null, // = false | ||
autoHeight?: boolean | null, // = true | ||
popupPlay?: boolean | null, // = false | ||
inlinePlay?: boolean | null, // = false, true will make video load before playing | ||
debug?: boolean | null) => void; | ||
declare global { | ||
interface Window { | ||
pingVpLoader?: () => void; | ||
pingvp?: any; | ||
pingvp?: { | ||
Webplayer?: WebplayerFunc; | ||
}; | ||
jQuery?: any; | ||
@@ -10,3 +19,3 @@ $?: any; | ||
declare class PingVideoLoader { | ||
loadVideo(elementId: string, videoName: string, autoStart: boolean): Promise<unknown> | undefined; | ||
loadVideo(elementId: string, videoName: string, autoStart: boolean): Promise<void> | void; | ||
private awaitElementLoad; | ||
@@ -13,0 +22,0 @@ private createScriptTag; |
@@ -16,11 +16,4 @@ "use strict"; | ||
return new Promise(function (resolve) { | ||
// Change empty div into a PingVP element | ||
targetElement.setAttribute('data-video', videoName); | ||
targetElement.setAttribute('data-language', 'Dutch'); | ||
targetElement.setAttribute('data-controls', 'inside'); | ||
if (autoStart) { | ||
targetElement.setAttribute('data-autoStart', 'true'); | ||
} | ||
targetElement.classList.add('PingVP'); | ||
_this.loadPingVpAsync(); | ||
// Load Ping video inside empty div | ||
_this.loadPingVpAsync(elementId, null, null, videoName, null, "Dutch", null, autoStart); | ||
_this.awaitElementLoad(targetElement, resolve); | ||
@@ -49,4 +42,9 @@ }); | ||
PingVideoLoader.prototype.loadPingVpAsync = function () { | ||
if (pingVideoPlayerIsLoaded && window.pingVpLoader) { | ||
window.pingVpLoader(); | ||
var _a; | ||
var webplayerArgs = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
webplayerArgs[_i] = arguments[_i]; | ||
} | ||
if (pingVideoPlayerIsLoaded) { | ||
(_a = window.pingvp).Webplayer.apply(_a, webplayerArgs); | ||
return; | ||
@@ -56,2 +54,3 @@ } | ||
var checkPingVp = setInterval(function () { | ||
var _a; | ||
// In reality, this is not exactly the point at which the whole script loading is completed; | ||
@@ -61,4 +60,5 @@ // ideally we would get a flag from window.pingvp indicating when the script is properly loaded. | ||
// or both will not be loaded depending on where in the cycle the second video is clicked. | ||
if (window.pingvp) { | ||
if (window.pingvp && window.pingvp.Webplayer) { | ||
clearInterval(checkPingVp); | ||
(_a = window.pingvp).Webplayer.apply(_a, webplayerArgs); | ||
pingVideoPlayerIsLoaded = true; | ||
@@ -65,0 +65,0 @@ } |
{ | ||
"name": "@nlo/ping-video-loader", | ||
"version": "0.0.1-alpha.85+004eb93", | ||
"version": "0.0.1-alpha.88+e94a64c", | ||
"description": "", | ||
@@ -23,3 +23,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "004eb9393ef1a6164c0d0c919e3d84da0c399672" | ||
"gitHead": "e94a64c9b1b3a9409ee61e10fe61b0f96a1e07a0" | ||
} |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
4797
100