@kks-web/player-sdk 1.0.7-beta.1 → 1.0.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +3 -3
- package/index.js +1 -1
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -27,7 +27,7 @@ var createEmbed = function createEmbed(_ref, element) {
|
|
|
27
27
|
_ref$title = _ref.title,
|
|
28
28
|
title = _ref$title === void 0 ? 'BlendVision' : _ref$title,
|
|
29
29
|
_ref$src = _ref.src,
|
|
30
|
-
src = _ref$src === void 0 ? "https://player.
|
|
30
|
+
src = _ref$src === void 0 ? "https://player.live.kkstream.io" : _ref$src;
|
|
31
31
|
|
|
32
32
|
if (!element) {
|
|
33
33
|
throw new TypeError('An element must be provided');
|
|
@@ -185,7 +185,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
185
185
|
config = {};
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
this.targetOrigin = "https://player.
|
|
188
|
+
this.targetOrigin = "https://player.live.kkstream.io" ;
|
|
189
189
|
this.element = null;
|
|
190
190
|
this.enableWatermark = false;
|
|
191
191
|
this.lastTouchEnd = 0;
|
|
@@ -208,7 +208,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
208
208
|
setElementCSS(document.body, restrictZoomCSS);
|
|
209
209
|
var _config = config,
|
|
210
210
|
_config$playerUrl = _config.playerUrl,
|
|
211
|
-
playerUrl = _config$playerUrl === void 0 ? "https://player.
|
|
211
|
+
playerUrl = _config$playerUrl === void 0 ? "https://player.live.kkstream.io" : _config$playerUrl,
|
|
212
212
|
_config$locale = _config.locale,
|
|
213
213
|
locale = _config$locale === void 0 ? 'en' : _config$locale,
|
|
214
214
|
token = _config.token,
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).BlendVision=e.BlendVision||{},e.BlendVision.Player=t())}(this,(function(){"use strict";function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.apply(this,arguments)}var t="width: 100%; height: 100%; border: none;",n="touch-action: pan-x pan-y;",i="overflow: hidden; position: relative; background-color: black;",o=function(e,t,n){var i,o;if(null!=(i=e.element)&&i.contentWindow&&null!=(o=e.element)&&o.contentWindow.postMessage){var r={command:t};void 0!==n&&(r.payload=n);var
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).BlendVision=e.BlendVision||{},e.BlendVision.Player=t())}(this,(function(){"use strict";function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.apply(this,arguments)}var t="width: 100%; height: 100%; border: none;",n="touch-action: pan-x pan-y;",i="overflow: hidden; position: relative; background-color: black;",o=function(e,t,n){var i,o;if(null!=(i=e.element)&&i.contentWindow&&null!=(o=e.element)&&o.contentWindow.postMessage){var r={command:t};void 0!==n&&(r.payload=n);var l=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));l>=8&&l<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.targetOrigin)}},r=function(){var e="viewport-fit=cover",t=document.querySelector('meta[name="viewport"]');if(t){var n=t.getAttribute("content");if(null!=n&&n.includes(e)){var i=n.split(",").filter((function(t){return t!==e}));t.setAttribute("content",i.join(", "))}else t.setAttribute("content",n?n+", "+e:e)}else{var o=document.createElement("meta");o.name="viewport",o.content="viewport-fit=cover",document.getElementsByTagName("head")[0].appendChild(o)}},l=function(e,t){if(e){var n=e.style.cssText;null!=n&&n.includes(t)||(e.style.cssText=n?""+n+t:t)}},s=function(e,t){if(e){var n=e.style.cssText;null!=n&&n.includes(t)&&(e.style.cssText=n.replaceAll(t,""))}};return function(){function a(i,r){var s,a=this;void 0===r&&(r={}),this.targetOrigin="https://player.live.kkstream.io",this.element=null,this.enableWatermark=!1,this.lastTouchEnd=0;var u=null;if("undefined"!=typeof document&&"string"==typeof i&&(u=document.getElementById(i)),i instanceof HTMLElement&&(u=i),!(u instanceof Element&&1===u.nodeType&&"nodeName"in u&&u.ownerDocument&&u.ownerDocument.defaultView))throw new TypeError("You must pass either a valid element or a valid id.");this.originalElement=u,l(document.body,n);var c=r,d=c.playerUrl,m=void 0===d?"https://player.live.kkstream.io":d,h=c.locale,f=void 0===h?"en":h,v=c.token,p=c.did,y=c.event,g=c.titleSpacing,b=c.disableFullscreen,E=void 0!==b&&b;if(this.onMessage=function(e){return function(e,t){switch(t.data.command){case"ping":o(e,"pong");break;case"onEnded":null==e.onEnded||e.onEnded();break;case"fullscreen":e.element===document.activeElement&&(null==e.fullscreen||e.fullscreen());break;case"exitFullscreen":e.element===document.activeElement&&(null==e.exitFullscreen||e.exitFullscreen());break;case"watermark":null==e.restrictZoom||e.restrictZoom();break;case"noWatermark":null==e.unrestrictZoom||e.unrestrictZoom()}}(a,e)},this.targetOrigin=m,this.onEnded=null==y?void 0:y.onEnded,this.onTouchStart=function(e){return function(e,t){e.enableWatermark&&t.touches.length>1&&t.preventDefault()}(a,e)},this.lastTouchEnd=0,this.onTouchEnd=function(e){return function(e,t){var n=(new Date).getTime();e.enableWatermark&&n-e.lastTouchEnd<=300&&t.preventDefault(),e.lastTouchEnd=n}(a,e)},this.startReceiveMessage(),this.handleTouchEvent(),"IFRAME"===(null==(s=u)?void 0:s.nodeName))this.element=i;else{var w,T=null==(w=u)?void 0:w.querySelector("iframe"),k=new URL(m+"/?t="+v+"&hl="+f+(p?"&did="+p:""));g&&k.searchParams.append("titleSpacing",g.toString()),E&&k.searchParams.append("disableFullscreen","true"),this.element=T||function(e,n){var i=e.style,o=void 0===i?t:i,r=e.title,l=void 0===r?"BlendVision":r,s=e.src,a=void 0===s?"https://player.live.kkstream.io":s;if(!n)throw new TypeError("An element must be provided");if(null!==n.getAttribute("data-bv-initialized"))return n.querySelector("iframe");var u=document.createElement("iframe");return u.style=o,u.width="100%",u.height="100%",u.src=a,u.title=l,u.allow="autoplay; encrypted-media",u.allowFullscreen=!0,n.appendChild(u),n.setAttribute("data-bv-initialized","true"),n.querySelector("iframe")}(e({src:k.toString()},r),u)}}var u=a.prototype;return u.fullscreen=function(){this.element&&(r(),l(document.body,i),this.element.style.cssText="\n position: fixed;\n inset:0;\n z-index:99999;\n top:0;\n left:0;\n right:0;\n bottom:0;\n background-color: black;\n transition: 1s position;\n display:flex;\n align-items:center;\n justify-content:center;\n width: 100%; height: 100%; border: none;\n")},u.exitFullscreen=function(){this.element&&(r(),s(document.body,i),this.element.style.cssText=t)},u.restrictZoom=function(){this.enableWatermark=!0,l(document.body,n)},u.unrestrictZoom=function(){this.enableWatermark=!1,s(document.body,n)},u.play=function(){o(this,"play")},u.pause=function(){o(this,"pause")},u.setVolume=function(e){o(this,"setVolume",{volume:e})},u.setQuality=function(e){o(this,"setQuality",{quality:e})},u.mute=function(){o(this,"mute")},u.destroy=function(){var e,t;this.originalElement&&this.originalElement.removeAttribute("data-bv-initialized"),null==(e=this.element)||null==(t=e.parentNode)||t.removeChild(this.element),window.removeEventListener("message",this.onMessage),document.body.removeEventListener("touchstart",this.onTouchStart,{passive:!1}),document.body.removeEventListener("touchend",this.onTouchEnd,!1)},u.startReceiveMessage=function(){window.addEventListener("message",this.onMessage)},u.handleTouchEvent=function(){document.body.addEventListener("touchstart",this.onTouchStart,{passive:!1}),document.body.addEventListener("touchend",this.onTouchEnd,!1)},a}()}));
|