@times-components/video 4.19.44-23af0f096003c9a79ae1c1ccdaf635413e12116f.4 → 4.19.45-e91f083a5edbb99cc0a9ffeb92e9e6e684d456b7.0
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/CHANGELOG.md +8 -0
- package/dist/inline-video-player.js +16 -1
- package/package.json +7 -7
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.19.44](https://github.com/newsuk/times-components/compare/@times-components/video@4.19.43...@times-components/video@4.19.44) (2025-11-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @times-components/video
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [4.19.43](https://github.com/newsuk/times-components/compare/@times-components/video@4.19.42...@times-components/video@4.19.43) (2025-11-20)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @times-components/video
|
|
@@ -86,12 +86,22 @@ var InlineVideoPlayer = /*#__PURE__*/function (_Component) {
|
|
|
86
86
|
_this.id = "".concat(props.videoId, "-").concat(props.accountId, "-").concat(props.id);
|
|
87
87
|
_this.videoContainerRef = _react["default"].createRef();
|
|
88
88
|
_this.observer = null;
|
|
89
|
+
_this.publicApi = {
|
|
90
|
+
handlePlay: _this.handlePlay,
|
|
91
|
+
play: _this.play
|
|
92
|
+
};
|
|
89
93
|
return _this;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
_createClass(InlineVideoPlayer, [{
|
|
93
97
|
key: "componentDidMount",
|
|
94
98
|
value: function componentDidMount() {
|
|
99
|
+
var forwardedRef = this.props.forwardedRef;
|
|
100
|
+
|
|
101
|
+
if (forwardedRef) {
|
|
102
|
+
forwardedRef.current = this.publicApi;
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
this.observer = this.createIntersectionObserver();
|
|
96
106
|
|
|
97
107
|
if (this.observer && this.videoContainerRef) {
|
|
@@ -283,7 +293,12 @@ _defineProperty(InlineVideoPlayer, "activePlayers", []);
|
|
|
283
293
|
|
|
284
294
|
_defineProperty(InlineVideoPlayer, "activeScripts", []);
|
|
285
295
|
|
|
296
|
+
var InlineVideoPlayerWithRef = (0, _react.forwardRef)(function (props, ref) {
|
|
297
|
+
return /*#__PURE__*/_react["default"].createElement(InlineVideoPlayer, _extends({}, props, {
|
|
298
|
+
forwardedRef: ref
|
|
299
|
+
}));
|
|
300
|
+
});
|
|
286
301
|
InlineVideoPlayer.defaultProps = _videoPropTypes.defaultProps;
|
|
287
302
|
InlineVideoPlayer.propTypes = _videoPropTypes.propTypes;
|
|
288
|
-
var _default =
|
|
303
|
+
var _default = InlineVideoPlayerWithRef;
|
|
289
304
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/video",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.45-e91f083a5edbb99cc0a9ffeb92e9e6e684d456b7.0+e91f083a5e",
|
|
4
4
|
"main": "dist/video",
|
|
5
5
|
"dev": "src/video",
|
|
6
6
|
"description": "Video",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@times-components/eslint-config-thetimes": "^0.8.18",
|
|
38
38
|
"@times-components/jest-configurator-web": "^0.8.2",
|
|
39
39
|
"@times-components/jest-serializer": "^3.18.9",
|
|
40
|
-
"@times-components/storybook": "^4.16.18
|
|
40
|
+
"@times-components/storybook": "^4.16.18",
|
|
41
41
|
"@times-components/test-utils": "^2.4.2",
|
|
42
42
|
"babel-jest": "24.8.0",
|
|
43
43
|
"babel-loader": "8.0.5",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"webpack": "4.30.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@times-components/error-view": "^2.6.101
|
|
56
|
-
"@times-components/icons": "^2.23.41
|
|
57
|
-
"@times-components/image": "^6.20.17
|
|
58
|
-
"@times-components/ts-styleguide": "^1.56.19
|
|
55
|
+
"@times-components/error-view": "^2.6.101",
|
|
56
|
+
"@times-components/icons": "^2.23.41",
|
|
57
|
+
"@times-components/image": "^6.20.17",
|
|
58
|
+
"@times-components/ts-styleguide": "^1.56.19",
|
|
59
59
|
"@times-components/utils": "^6.35.3",
|
|
60
60
|
"prop-types": "15.7.2",
|
|
61
61
|
"styled-components": "4.3.2"
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "e91f083a5edbb99cc0a9ffeb92e9e6e684d456b7"
|
|
80
80
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports={base:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxtYXNrIGlkPSJtYXNrMF8yNzAxXzMzNDkyIiBzdHlsZT0ibWFzay10eXBlOmFscGhhIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiBmaWxsPSIjQTA4MjgyIi8+CjwvbWFzaz4KPGcgbWFzaz0idXJsKCNtYXNrMF8yNzAxXzMzNDkyKSI+CjxjaXJjbGUgY3g9Ii0wLjAwNjAwNDMzIiBjeT0iMTI4LjAwMiIgcj0iMTE2LjM2NCIgZmlsbD0idXJsKCNwYWludDBfcmFkaWFsXzI3MDFfMzM0OTIpIiBmaWxsLW9wYWNpdHk9IjAuNiIvPgo8L2c+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNzIgNTZIOFYxMjBINzJWNTZaTTUwLjggODcuOEwzMCAxMDAuNlY3NUw1MC44IDg3LjhaIiBmaWxsPSJ3aGl0ZSIvPgo8ZGVmcz4KPHJhZGlhbEdyYWRpZW50IGlkPSJwYWludDBfcmFkaWFsXzI3MDFfMzM0OTIiIGN4PSIwIiBjeT0iMCIgcj0iMSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIGdyYWRpZW50VHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTAuMDA2MDA0MzMgMTI4LjAwMikgcm90YXRlKDkwKSBzY2FsZSg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0cmFuc2xhdGUoLTAuMDA1NTE2MDUgMTI4LjAwMikgcm90YXRlKDkwKSBzY2FsZSgxMTYuMzY0KSI+CjxzdG9wLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLW9wYWNpdHk9IjAiLz4KPC9yYWRpYWxHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K"}},function(e,t){e.exports=require("@times-components/image/rnw")},function(e,t){e.exports=require("@times-components/error-view/rnw")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/icons/rnw")},function(e,t,n){"use strict";n.r(t);var i=n(0),o=n.n(i),r=n(5),a=n.n(r),c=n(6),s=n.n(c),l=n(7),u=n(1),d=n.n(u),p=d.a.oneOfType([d.a.string,d.a.number]),f=(d.a.string.isRequired,p.isRequired,d.a.string,d.a.bool,d.a.string,d.a.string.isRequired,d.a.shape({uri:d.a.string.isRequired}),d.a.string.isRequired,p.isRequired,{is360:!1,playerId:"default",poster:null}),h=n(8),y=n(2),b=n(3),g=n.n(b),I=g.a.div.withConfig({displayName:"styles__Video360Container",componentId:"sc-1b2p9l4-0"})(['border-radius:100%;left:50%;position:absolute;height:100px;top:50%;transform:translate(-50%,-50%);width:100px;z-index:1;pointer-events:none;[data-is-360="true"]:hover &{background:rgba(0,0,0,0.2);}']),v=g.a.div.withConfig({displayName:"styles__VideoErrorContainer",componentId:"sc-1b2p9l4-1"})(["display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:",";"],y.colours.functional.transparentBlack),m=g.a.span.withConfig({displayName:"styles__VideoErrorHeading",componentId:"sc-1b2p9l4-2"})(["color:white;font-family:",";font-size:20px;height:auto;width:auto;margin-bottom:",";text-align:center;"],y.fontsWithFallback.headline,Object(y.spacing)(2)),j=g.a.span.withConfig({displayName:"styles__VideoErrorBody",componentId:"sc-1b2p9l4-3"})(["color:rgba(255,255,255,0.8);font-family:",";font-size:14px;height:auto;max-width:80%;text-align:center;width:410px;"],y.fontsWithFallback.body),w=g.a.div.withConfig({displayName:"styles__NoSubscriptionWrapper",componentId:"sc-1b2p9l4-4"})(["position:absolute;height:65px;left:0;right:0;top:50%;margin-top:-32px;"]),x=g.a.span.withConfig({displayName:"styles__NoSubscriptionMessage",componentId:"sc-1b2p9l4-5"})(["background-color:rgba(0,0,0,0.7);color:",";margin-left:auto;margin-right:auto;max-width:80%;padding:",";text-align:center;width:300px;font-family:",";font-size:14px;"],y.colours.functional.contrast,Object(y.spacing)(2),y.fontsWithFallback.body),M=function(){return o.a.createElement(I,null,o.a.createElement(h.IconVideo360Player,{fillColour:y.colours.functional.white,height:100}))},N=n(4),z=n.n(N);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function W(){return(W=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}).apply(this,arguments)}function S(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=E(e);if(t){var o=E(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return B(this,n)}}function B(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?Z(e):t}function Z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var D='\n div[data-is-360="true"] button.vjs-big-play-button {\n display: none !important;\n }\n\n .video-js .vjs-big-play-button {\n margin: 0;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n background-color: unset !important;\n }\n\n .video-js .vjs-dock-text {\n visibility: hidden;\n }\n\n .video-js .vjs-poster {\n background-size: cover;\n }\n\n .video-js .vjs-tech {\n position: relative;\n }\n\n .vjs-big-play-button .vjs-icon-placeholder::before, .vjs-big-play-button .vjs-icon-placeholder::after {\n content: "" !important;\n\n position: absolute;\n top: unset !important;\n bottom: 0;\n left: 0;\n \n background-image: url('.concat(z.a.base,");\n background-size: contain;\n background-repeat: no-repeat;\n \n aspect-ratio: 1 !important;\n width: 25% !important;\n height: unset !important;\n min-width: 80px;\n min-height: 80px;\n max-width: 128px;\n max-height: 128px;\n transition: opacity 100ms ease-in-out;\n }\n\n .vjs-big-play-button .vjs-icon-placeholder::before {\n background-image: url(").concat(z.a.base,");\n opacity: 1;\n }\n\n .vjs-big-play-button .vjs-icon-placeholder::after {\n background-image: url(").concat(z.a.hover,");\n opacity: 0;\n }\n\n .vjs-big-play-button:hover .vjs-icon-placeholder::before {\n opacity: 0;\n }\n .vjs-big-play-button:hover .vjs-icon-placeholder::after {\n opacity: 1;\n }\n .vjs-big-play-button:focus .vjs-icon-placeholder::before {\n background-image: url(").concat(z.a.hover,");\n }\n\n .vjs-big-play-button:focus {\n outline: none;\n }\n\n .video-js.vjs-has-started .vjs-big-play-button .vjs-icon-placeholder::before, .video-js.vjs-has-started .vjs-big-play-button .vjs-icon-placeholder::after {\n display: none !important;\n }\n"),T=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(c,e);var t,n,r,a=C(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),O(Z(t=a.call(this,e)),"handleError",(function(){t.setState({error:!0})})),O(Z(t),"handlePlay",(function(){t.setState({hasVideoPlayed:!0}),c.activePlayers.forEach((function(e){e!==Z(t)&&e.player&&e.player.pause()}))})),t.state={error:null,hasVideoPlayed:!1},t.id="".concat(e.videoId,"-").concat(e.accountId,"-").concat(e.id),t.videoContainerRef=o.a.createRef(),t.observer=null,t}return t=c,r=[{key:"brightcoveSDKHasLoaded",value:function(){return!(!window.bc||!window.videojs)}},{key:"appendScript",value:function(e){document.body.appendChild(e)}},{key:"attachStyles",value:function(){var e=document.createElement("style");e.type="text/css";var t=document.createTextNode(D);e.appendChild(t),document.head.appendChild(e)}}],(n=[{key:"componentDidMount",value:function(){this.observer=this.createIntersectionObserver(),this.observer&&this.videoContainerRef&&this.observer.observe(this.videoContainerRef.current),this.loadBrightcoveSDKIfRequired(),c.scriptLoadError&&this.handleError(c.scriptLoadError),c.activePlayers.push(this),c.brightcoveSDKHasLoaded()&&this.initBrightcove()}},{key:"componentWillUnmount",value:function(){c.activePlayers.splice(c.activePlayers.indexOf(this)),this.player&&(this.player.dispose(),this.player=null),this.observer&&this.observer.disconnect()}},{key:"createIntersectionObserver",value:function(){var e=this;return"IntersectionObserver"in window?new window.IntersectionObserver((function(t){t[0].isIntersecting&&e.loadBrightcoveSDKIfRequired()})):null}},{key:"loadBrightcoveSDKIfRequired",value:function(){var e=this.createBrightcoveScript();e&&(e.onload=function(){c.activePlayers.forEach((function(e){return e.initVideojs()}))},e.onerror=function(){c.scriptLoadError="Brightcove script failed to load",c.activePlayers.forEach((function(e){return e.handleError()}))},c.appendScript(e),c.attachStyles())}},{key:"createBrightcoveScript",value:function(){var e=this.props,t=e.accountId,n=e.playerId,i=e.videoId,o=document.createElement("script");return o.src="//players.brightcove.net/".concat(t,"/").concat(n,"_default/index.min.js?videoID=").concat(i),o.defer=!0,c.activeScripts.includes(o.src)?null:(c.activeScripts.push(o.src),o)}},{key:"initVideojs",value:function(){var e=this;this.player=window.videojs(this.id),this.player.ready((function(){e.player.contextmenu({disabled:!0})})),this.player.on("error",this.handleError),this.player.on("play",this.handlePlay)}},{key:"initBrightcove",value:function(){window.bc(document.getElementById(this.id)),this.initVideojs()}},{key:"render",value:function(){var e=this.props,t=e.width,n=e.height,r=e.poster,a=e.videoId,c=e.accountId,s=e.playerId,u=e.is360,d=this.state,p=d.error,f=d.hasVideoPlayed;if(p)throw new Error("Can't load video");return o.a.createElement("div",{"data-is-360":u,"data-testid":"video-component",ref:this.videoContainerRef,style:{height:n,width:t},className:"lcpItem"},o.a.createElement("div",{style:{height:n,width:t,position:"relative"}},!f&&o.a.createElement(i.Fragment,null,u&&o.a.createElement(M,null)),o.a.createElement("video",W({id:this.id,style:{height:n,width:t}},r?{poster:Object(l.appendToImageURL)(r.uri,"resize",960)}:{},{className:"video-js",controls:!0,"data-account":c,"data-application-id":!0,"data-embed":"default","data-player":s,"data-video-id":a}))))}}])&&S(t.prototype,n),r&&S(t,r),c}(i.Component);O(T,"scriptLoadError",!1),O(T,"activePlayers",[]),O(T,"activeScripts",[]),T.defaultProps=f;var Y=T,R=o.a.createContext(!0),G=function(e){var t=e.height,n=e.width;return o.a.createElement(v,{style:{height:t,width:n}},o.a.createElement(m,null,"Video unable to play"),o.a.createElement(j,null,"Please check your network connection and try refreshing the page. If that doesn't work, please try again later"))};n.d(t,"IsPaidSubscriberContext",(function(){return A}));var L=function(e){var t=e.height,n=e.poster,i=e.width;return o.a.createElement(s.a,null,(function(r){return r.hasError?o.a.createElement(G,{height:t,width:i}):o.a.createElement(R.Consumer,null,(function(r){return r?o.a.createElement(Y,e):o.a.createElement("div",{style:{height:t,width:i}},o.a.createElement(a.a,{aspectRatio:i/t,uri:n.uri}),o.a.createElement(w,null,o.a.createElement(x,null,"We are sorry, you need to be a subscriber to watch this video")))}))}))};L.defaultProps=f;t.default=L;var A=R.Provider}]);
|
|
1
|
+
module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports={base:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxtYXNrIGlkPSJtYXNrMF8yNzAxXzMzNDkyIiBzdHlsZT0ibWFzay10eXBlOmFscGhhIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiBmaWxsPSIjQTA4MjgyIi8+CjwvbWFzaz4KPGcgbWFzaz0idXJsKCNtYXNrMF8yNzAxXzMzNDkyKSI+CjxjaXJjbGUgY3g9Ii0wLjAwNj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zMyNzk4KSI+CjxjaXJjbGUgY3g9Ii0wLjAwNTUxNjA1IiBjeT0iMTI4LjAwMiIgcj0iMTE2LjM2NCIgZmlsbD0idXJsKCNwYWludDBfcmFkaWFsXzI4MDBfMzI3OTgpIiBmaWxsLW9wYWNpdHk9IjAuNiIvPgo8L2c+CjxyZWN0IHg9IjguNSIgeT0iNTYuNSIgd2lkdGg9IjYzIiBoZWlnaHQ9IjYzIiBmaWxsPSIjMDA1MjdBIiBzdHJva2U9IndoaXRlIi8+CjxwYXRoIGQ9Ik0zMCA3NVYxMDAuNkw1MC44IDg3LjhMMzAgNzVaIiBmaWxsPSJ3aGl0ZSIvPgo8ZGVmcz4KPHJhZGlhbEdyYWRpZW50IGlkPSJwYWludDBfcmFkaWFsXzI4MDBfMzI3OTgiIGN4PSIwIiBjeT0iMCIgcj0iMSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIGdyYWRpZW50VHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTAuMDA1NTE2MDUgMTI4LjAwMikgcm90YXRlKDkwKSBzY2FsZSgxMTYuMzY0KSI+CjxzdG9wLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLW9wYWNpdHk9IjAiLz4KPC9yYWRpYWxHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K"}},function(e,t){e.exports=require("@times-components/image/rnw")},function(e,t){e.exports=require("@times-components/error-view/rnw")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/icons/rnw")},function(e,t,n){"use strict";n.r(t);var i=n(0),r=n.n(i),o=n(5),a=n.n(o),c=n(6),l=n.n(c),s=n(7),u=n(1),d=n.n(u),p=d.a.oneOfType([d.a.string,d.a.number]),f=(d.a.string.isRequired,p.isRequired,d.a.string,d.a.bool,d.a.string,d.a.string.isRequired,d.a.shape({uri:d.a.string.isRequired}),d.a.string.isRequired,p.isRequired,{is360:!1,playerId:"default",poster:null}),h=n(8),y=n(2),b=n(3),g=n.n(b),v=g.a.div.withConfig({displayName:"styles__Video360Container",componentId:"sc-1b2p9l4-0"})(['border-radius:100%;left:50%;position:absolute;height:100px;top:50%;transform:translate(-50%,-50%);width:100px;z-index:1;pointer-events:none;[data-is-360="true"]:hover &{background:rgba(0,0,0,0.2);}']),I=g.a.div.withConfig({displayName:"styles__VideoErrorContainer",componentId:"sc-1b2p9l4-1"})(["display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:",";"],y.colours.functional.transparentBlack),m=g.a.span.withConfig({displayName:"styles__VideoErrorHeading",componentId:"sc-1b2p9l4-2"})(["color:white;font-family:",";font-size:20px;height:auto;width:auto;margin-bottom:",";text-align:center;"],y.fontsWithFallback.headline,Object(y.spacing)(2)),j=g.a.span.withConfig({displayName:"styles__VideoErrorBody",componentId:"sc-1b2p9l4-3"})(["color:rgba(255,255,255,0.8);font-family:",";font-size:14px;height:auto;max-width:80%;text-align:center;width:410px;"],y.fontsWithFallback.body),w=g.a.div.withConfig({displayName:"styles__NoSubscriptionWrapper",componentId:"sc-1b2p9l4-4"})(["position:absolute;height:65px;left:0;right:0;top:50%;margin-top:-32px;"]),x=g.a.span.withConfig({displayName:"styles__NoSubscriptionMessage",componentId:"sc-1b2p9l4-5"})(["background-color:rgba(0,0,0,0.7);color:",";margin-left:auto;margin-right:auto;max-width:80%;padding:",";text-align:center;width:300px;font-family:",";font-size:14px;"],y.colours.functional.contrast,Object(y.spacing)(2),y.fontsWithFallback.body),M=function(){return r.a.createElement(v,null,r.a.createElement(h.IconVideo360Player,{fillColour:y.colours.functional.white,height:100}))},N=n(4),P=n.n(N);function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function W(){return(W=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}).apply(this,arguments)}function S(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=E(e);if(t){var r=E(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return B(this,n)}}function B(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?Z(e):t}function Z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var D='\n div[data-is-360="true"] button.vjs-big-play-button {\n display: none !important;\n }\n\n .video-js .vjs-big-play-button {\n margin: 0;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n background-color: unset !important;\n }\n\n .video-js .vjs-dock-text {\n visibility: hidden;\n }\n\n .video-js .vjs-poster {\n background-size: cover;\n }\n\n .video-js .vjs-tech {\n position: relative;\n }\n\n .vjs-big-play-button .vjs-icon-placeholder::before, .vjs-big-play-button .vjs-icon-placeholder::after {\n content: "" !important;\n\n position: absolute;\n top: unset !important;\n bottom: 0;\n left: 0;\n \n background-image: url('.concat(P.a.base,");\n background-size: contain;\n background-repeat: no-repeat;\n \n aspect-ratio: 1 !important;\n width: 25% !important;\n height: unset !important;\n min-width: 80px;\n min-height: 80px;\n max-width: 128px;\n max-height: 128px;\n transition: opacity 100ms ease-in-out;\n }\n\n .vjs-big-play-button .vjs-icon-placeholder::before {\n background-image: url(").concat(P.a.base,");\n opacity: 1;\n }\n\n .vjs-big-play-button .vjs-icon-placeholder::after {\n background-image: url(").concat(P.a.hover,");\n opacity: 0;\n }\n\n .vjs-big-play-button:hover .vjs-icon-placeholder::before {\n opacity: 0;\n }\n .vjs-big-play-button:hover .vjs-icon-placeholder::after {\n opacity: 1;\n }\n .vjs-big-play-button:focus .vjs-icon-placeholder::before {\n background-image: url(").concat(P.a.hover,");\n }\n\n .vjs-big-play-button:focus {\n outline: none;\n }\n\n .video-js.vjs-has-started .vjs-big-play-button .vjs-icon-placeholder::before, .video-js.vjs-has-started .vjs-big-play-button .vjs-icon-placeholder::after {\n display: none !important;\n }\n"),T=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(c,e);var t,n,o,a=C(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),O(Z(t=a.call(this,e)),"handleError",(function(){t.setState({error:!0})})),O(Z(t),"handlePlay",(function(){t.setState({hasVideoPlayed:!0}),c.activePlayers.forEach((function(e){e!==Z(t)&&e.player&&e.player.pause()}))})),t.state={error:null,hasVideoPlayed:!1},t.id="".concat(e.videoId,"-").concat(e.accountId,"-").concat(e.id),t.videoContainerRef=r.a.createRef(),t.observer=null,t.publicApi={handlePlay:t.handlePlay,play:t.play},t}return t=c,o=[{key:"brightcoveSDKHasLoaded",value:function(){return!(!window.bc||!window.videojs)}},{key:"appendScript",value:function(e){document.body.appendChild(e)}},{key:"attachStyles",value:function(){var e=document.createElement("style");e.type="text/css";var t=document.createTextNode(D);e.appendChild(t),document.head.appendChild(e)}}],(n=[{key:"componentDidMount",value:function(){var e=this.props.forwardedRef;e&&(e.current=this.publicApi),this.observer=this.createIntersectionObserver(),this.observer&&this.videoContainerRef&&this.observer.observe(this.videoContainerRef.current),this.loadBrightcoveSDKIfRequired(),c.scriptLoadError&&this.handleError(c.scriptLoadError),c.activePlayers.push(this),c.brightcoveSDKHasLoaded()&&this.initBrightcove()}},{key:"componentWillUnmount",value:function(){c.activePlayers.splice(c.activePlayers.indexOf(this)),this.player&&(this.player.dispose(),this.player=null),this.observer&&this.observer.disconnect()}},{key:"createIntersectionObserver",value:function(){var e=this;return"IntersectionObserver"in window?new window.IntersectionObserver((function(t){t[0].isIntersecting&&e.loadBrightcoveSDKIfRequired()})):null}},{key:"loadBrightcoveSDKIfRequired",value:function(){var e=this.createBrightcoveScript();e&&(e.onload=function(){c.activePlayers.forEach((function(e){return e.initVideojs()}))},e.onerror=function(){c.scriptLoadError="Brightcove script failed to load",c.activePlayers.forEach((function(e){return e.handleError()}))},c.appendScript(e),c.attachStyles())}},{key:"createBrightcoveScript",value:function(){var e=this.props,t=e.accountId,n=e.playerId,i=e.videoId,r=document.createElement("script");return r.src="//players.brightcove.net/".concat(t,"/").concat(n,"_default/index.min.js?videoID=").concat(i),r.defer=!0,c.activeScripts.includes(r.src)?null:(c.activeScripts.push(r.src),r)}},{key:"initVideojs",value:function(){var e=this;this.player=window.videojs(this.id),this.player.ready((function(){e.player.contextmenu({disabled:!0})})),this.player.on("error",this.handleError),this.player.on("play",this.handlePlay)}},{key:"initBrightcove",value:function(){window.bc(document.getElementById(this.id)),this.initVideojs()}},{key:"render",value:function(){var e=this.props,t=e.width,n=e.height,o=e.poster,a=e.videoId,c=e.accountId,l=e.playerId,u=e.is360,d=this.state,p=d.error,f=d.hasVideoPlayed;if(p)throw new Error("Can't load video");return r.a.createElement("div",{"data-is-360":u,"data-testid":"video-component",ref:this.videoContainerRef,style:{height:n,width:t},className:"lcpItem"},r.a.createElement("div",{style:{height:n,width:t,position:"relative"}},!f&&r.a.createElement(i.Fragment,null,u&&r.a.createElement(M,null)),r.a.createElement("video",W({id:this.id,style:{height:n,width:t}},o?{poster:Object(s.appendToImageURL)(o.uri,"resize",960)}:{},{className:"video-js",controls:!0,"data-account":c,"data-application-id":!0,"data-embed":"default","data-player":l,"data-video-id":a}))))}}])&&S(t.prototype,n),o&&S(t,o),c}(i.Component);O(T,"scriptLoadError",!1),O(T,"activePlayers",[]),O(T,"activeScripts",[]);var R=Object(i.forwardRef)((function(e,t){return r.a.createElement(T,W({},e,{forwardedRef:t}))}));T.defaultProps=f;var Y=R,G=r.a.createContext(!0),A=function(e){var t=e.height,n=e.width;return r.a.createElement(I,{style:{height:t,width:n}},r.a.createElement(m,null,"Video unable to play"),r.a.createElement(j,null,"Please check your network connection and try refreshing the page. If that doesn't work, please try again later"))};n.d(t,"IsPaidSubscriberContext",(function(){return H}));var L=function(e){var t=e.height,n=e.poster,i=e.width;return r.a.createElement(l.a,null,(function(o){return o.hasError?r.a.createElement(A,{height:t,width:i}):r.a.createElement(G.Consumer,null,(function(o){return o?r.a.createElement(Y,e):r.a.createElement("div",{style:{height:t,width:i}},r.a.createElement(a.a,{aspectRatio:i/t,uri:n.uri}),r.a.createElement(w,null,r.a.createElement(x,null,"We are sorry, you need to be a subscriber to watch this video")))}))}))};L.defaultProps=f;t.default=L;var H=G.Provider}]);
|