@ilo-org/react 0.10.6 → 0.11.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 +14 -0
- package/lib/cjs/AccordionCtx-be704051.js +9 -0
- package/lib/cjs/{GlobalCtx-97e4b433.js → GlobalCtx-10114bdd.js} +2 -2
- package/lib/cjs/ListCtx-14aa546f.js +9 -0
- package/lib/cjs/TagCtx-690a1d54.js +7 -0
- package/lib/cjs/components/Accordion/Accordion.js +6 -6
- package/lib/cjs/components/Accordion/AccordionButton.js +5 -5
- package/lib/cjs/components/Accordion/AccordionItem.js +2 -2
- package/lib/cjs/components/Accordion/AccordionPanel.js +8 -8
- package/lib/cjs/components/Accordion/index.js +2 -2
- package/lib/cjs/components/Breadcrumb/Breadcrumb.js +5 -5
- package/lib/cjs/components/Breadcrumb/index.js +1 -1
- package/lib/cjs/components/Button/Button.js +1 -1
- package/lib/cjs/components/Button/index.js +1 -1
- package/lib/cjs/components/Callout/Callout.js +4 -4
- package/lib/cjs/components/Callout/index.js +1 -1
- package/lib/cjs/components/Card/Card.js +2 -2
- package/lib/cjs/components/Card/CardGroup.js +2 -2
- package/lib/cjs/components/Card/index.js +2 -2
- package/lib/cjs/components/Checkbox/Checkbox.js +5 -5
- package/lib/cjs/components/Checkbox/index.js +1 -1
- package/lib/cjs/components/Collapse/Collapse.js +1194 -44
- package/lib/cjs/components/Collapse/index.js +0 -1
- package/lib/cjs/components/ContextMenu/ContextMenu.js +1 -1
- package/lib/cjs/components/ContextMenu/index.js +1 -1
- package/lib/cjs/components/Credit/Credit.js +3 -3
- package/lib/cjs/components/Credit/index.js +1 -1
- package/lib/cjs/components/DatePicker/DatePicker.js +4 -4
- package/lib/cjs/components/DatePicker/index.js +1 -1
- package/lib/cjs/components/Dropdown/Dropdown.js +5 -5
- package/lib/cjs/components/Dropdown/index.js +1 -1
- package/lib/cjs/components/Empty/Empty.js +1 -1
- package/lib/cjs/components/Empty/index.js +1 -1
- package/lib/cjs/components/Fieldset/Fieldset.js +5 -5
- package/lib/cjs/components/Fieldset/index.js +1 -1
- package/lib/cjs/components/FileUpload/FileUpload.js +5 -5
- package/lib/cjs/components/FileUpload/index.js +1 -1
- package/lib/cjs/components/Footer/Footer.js +1 -1
- package/lib/cjs/components/Footer/index.js +1 -1
- package/lib/cjs/components/Form/Form.js +3 -3
- package/lib/cjs/components/Form/index.js +1 -1
- package/lib/cjs/components/FormControl/FormControl.js +7 -7
- package/lib/cjs/components/FormControl/index.js +1 -1
- package/lib/cjs/components/GlobalProvider/GlobalProvider.js +1 -1
- package/lib/cjs/components/GlobalProvider/index.js +1 -1
- package/lib/cjs/components/Heading/Heading.js +1 -1
- package/lib/cjs/components/Heading/index.js +1 -1
- package/lib/cjs/components/Hero/Hero.js +1 -1
- package/lib/cjs/components/Hero/HeroCard.js +1 -1
- package/lib/cjs/components/Hero/index.js +1 -1
- package/lib/cjs/components/Icon/Icon.js +3 -3
- package/lib/cjs/components/Icon/index.js +1 -1
- package/lib/cjs/components/Image/Image.js +1 -1
- package/lib/cjs/components/Image/index.js +1 -1
- package/lib/cjs/components/Input/Input.js +1 -1
- package/lib/cjs/components/Input/index.js +1 -1
- package/lib/cjs/components/Link/Link.js +1 -1
- package/lib/cjs/components/Link/index.js +1 -1
- package/lib/cjs/components/LinkList/LinkList.js +1 -1
- package/lib/cjs/components/LinkList/index.js +1 -1
- package/lib/cjs/components/List/List.js +4 -4
- package/lib/cjs/components/List/ListItem.js +2 -2
- package/lib/cjs/components/List/index.js +2 -2
- package/lib/cjs/components/Loading/Loading.js +1 -1
- package/lib/cjs/components/Loading/index.js +1 -1
- package/lib/cjs/components/LocalNav/LocalNav.js +4 -4
- package/lib/cjs/components/LocalNav/index.js +1 -1
- package/lib/cjs/components/Logo/Logo.js +15 -15
- package/lib/cjs/components/Logo/index.js +1 -1
- package/lib/cjs/components/LogoGrid/LogoGrid.js +1 -1
- package/lib/cjs/components/LogoGrid/index.js +1 -1
- package/lib/cjs/components/Navigation/Navigation.js +6 -6
- package/lib/cjs/components/Navigation/index.js +1 -1
- package/lib/cjs/components/Notification/Notification.js +3 -3
- package/lib/cjs/components/Notification/index.js +1 -1
- package/lib/cjs/components/NumberPicker/NumberPicker.js +4 -4
- package/lib/cjs/components/NumberPicker/index.js +1 -1
- package/lib/cjs/components/Pagination/Pagination.js +1 -1
- package/lib/cjs/components/Pagination/index.js +1 -1
- package/lib/cjs/components/Profile/Profile.js +1 -1
- package/lib/cjs/components/Profile/index.js +1 -1
- package/lib/cjs/components/Radio/Radio.js +5 -5
- package/lib/cjs/components/Radio/index.js +1 -1
- package/lib/cjs/components/ReadMore/ReadMore.js +4 -4
- package/lib/cjs/components/ReadMore/index.js +1 -1
- package/lib/cjs/components/RichText/RichText.js +1 -1
- package/lib/cjs/components/RichText/index.js +1 -1
- package/lib/cjs/components/SearchField/SearchField.js +3 -3
- package/lib/cjs/components/SearchField/index.js +1 -1
- package/lib/cjs/components/SocialMedia/SocialMedia.js +1 -1
- package/lib/cjs/components/SocialMedia/index.js +1 -1
- package/lib/cjs/components/TableOfContents/TableOfContents.js +1 -1
- package/lib/cjs/components/TableOfContents/index.js +1 -1
- package/lib/cjs/components/Tabs/Tabs.args.js +156 -0
- package/lib/cjs/components/Tabs/Tabs.js +24 -0
- package/lib/cjs/components/Tabs/index.js +15 -0
- package/lib/cjs/components/Tag/Tag.js +4 -4
- package/lib/cjs/components/Tag/TagSet.js +6 -6
- package/lib/cjs/components/Tag/index.js +2 -2
- package/lib/cjs/components/TextInput/TextInput.js +4 -4
- package/lib/cjs/components/TextInput/index.js +1 -1
- package/lib/cjs/components/Textarea/Textarea.js +4 -4
- package/lib/cjs/components/Textarea/index.js +1 -1
- package/lib/cjs/components/Toggle/Toggle.js +4 -4
- package/lib/cjs/components/Toggle/index.js +1 -1
- package/lib/cjs/components/Tooltip/Tooltip.js +5 -5
- package/lib/cjs/components/Tooltip/index.js +1 -1
- package/lib/cjs/components/Video/Video.js +11 -12
- package/lib/cjs/components/Video/VideoPlayer.js +55 -13
- package/lib/cjs/components/Video/index.js +6 -8
- package/lib/cjs/components/index.js +9 -8
- package/lib/cjs/hooks/index.js +1 -1
- package/lib/cjs/hooks/useGlobalSettings.js +3 -3
- package/lib/cjs/hooks/usePrevious.js +3 -3
- package/lib/cjs/hooks/useVideoPlayer.js +7 -7
- package/lib/cjs/index.js +9 -8
- package/lib/esm/components/Collapse/Collapse.js +1156 -6
- package/lib/esm/components/Collapse/index.js +0 -1
- package/lib/esm/components/FileUpload/FileUpload.js +3 -3
- package/lib/esm/components/NumberPicker/NumberPicker.js +3 -3
- package/lib/esm/components/Radio/Radio.js +3 -3
- package/lib/esm/components/Tabs/Tabs.args.js +154 -0
- package/lib/esm/components/Tabs/Tabs.js +22 -0
- package/lib/esm/components/Tabs/index.js +9 -0
- package/lib/esm/components/TextInput/TextInput.js +3 -3
- package/lib/esm/components/Textarea/Textarea.js +3 -3
- package/lib/esm/components/Video/Video.js +10 -11
- package/lib/esm/components/Video/VideoPlayer.js +57 -11
- package/lib/esm/components/Video/index.js +5 -7
- package/lib/esm/components/index.js +4 -4
- package/lib/esm/index.js +4 -4
- package/lib/types/react/src/components/Tabs/Tabs.args.d.ts +10 -0
- package/lib/types/react/src/components/Tabs/Tabs.d.ts +4 -0
- package/lib/types/react/src/components/Tabs/Tabs.props.d.ts +12 -0
- package/lib/types/react/src/components/Tabs/index.d.ts +1 -0
- package/lib/types/react/src/components/Video/Video.d.ts +2 -2
- package/lib/types/react/src/components/Video/Video.props.d.ts +5 -43
- package/lib/types/react/src/components/Video/VideoPlayer.d.ts +3 -3
- package/lib/types/react/src/components/Video/VideoPlayer.props.d.ts +6 -31
- package/lib/types/react/src/components/index.d.ts +1 -0
- package/package.json +9 -7
- package/src/components/Tabs/Tabs.args.tsx +201 -0
- package/src/components/Tabs/Tabs.props.ts +13 -0
- package/src/components/Tabs/Tabs.tsx +60 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Video/Video.args.ts +18 -24
- package/src/components/Video/Video.props.ts +5 -47
- package/src/components/Video/Video.tsx +24 -19
- package/src/components/Video/VideoPlayer.props.ts +7 -38
- package/src/components/Video/VideoPlayer.tsx +67 -322
- package/src/components/index.ts +1 -0
- package/src/declarations.d.ts +22 -0
- package/lib/cjs/AccordionCtx-fe08ff45.js +0 -9
- package/lib/cjs/DailyMotion-17b56ecb.js +0 -259
- package/lib/cjs/Facebook-0c8d86ee.js +0 -239
- package/lib/cjs/FilePlayer-01d6dc08.js +0 -596
- package/lib/cjs/Kaltura-40e8e581.js +0 -235
- package/lib/cjs/ListCtx-7db7fe04.js +0 -9
- package/lib/cjs/Mixcloud-e23f49d6.js +0 -222
- package/lib/cjs/Preview-8e490f54.js +0 -227
- package/lib/cjs/SoundCloud-2500b6cb.js +0 -249
- package/lib/cjs/Streamable-00723065.js +0 -234
- package/lib/cjs/TagCtx-929c7753.js +0 -7
- package/lib/cjs/Twitch-2c5c5733.js +0 -244
- package/lib/cjs/VideoPlayer-5f0a64c6.js +0 -2067
- package/lib/cjs/Vidyard-d36d6c45.js +0 -237
- package/lib/cjs/Vimeo-d311e3b8.js +0 -285
- package/lib/cjs/Wistia-318b4e43.js +0 -288
- package/lib/cjs/YouTube-a3796a55.js +0 -377
- package/lib/cjs/index-0af02e81.js +0 -1154
- package/lib/esm/DailyMotion-989c2db3.js +0 -257
- package/lib/esm/Facebook-04e9cc59.js +0 -237
- package/lib/esm/FilePlayer-0789336d.js +0 -594
- package/lib/esm/Kaltura-a9ed37a9.js +0 -233
- package/lib/esm/Mixcloud-5a3b4353.js +0 -220
- package/lib/esm/Preview-7ca1835e.js +0 -225
- package/lib/esm/SoundCloud-47bccd79.js +0 -247
- package/lib/esm/Streamable-ee762126.js +0 -232
- package/lib/esm/Twitch-3cd4b54b.js +0 -242
- package/lib/esm/VideoPlayer-96c2b20c.js +0 -2062
- package/lib/esm/Vidyard-258ab0ef.js +0 -235
- package/lib/esm/Vimeo-4b29b580.js +0 -283
- package/lib/esm/Wistia-3cbce669.js +0 -286
- package/lib/esm/YouTube-db52da1c.js +0 -375
- package/lib/esm/index-623ce3f5.js +0 -1152
|
@@ -1,596 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var components_Video_VideoPlayer = require('./VideoPlayer-5f0a64c6.js');
|
|
4
|
-
var require$$0 = require('react');
|
|
5
|
-
|
|
6
|
-
function _mergeNamespaces(n, m) {
|
|
7
|
-
m.forEach(function (e) {
|
|
8
|
-
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
9
|
-
if (k !== 'default' && !(k in n)) {
|
|
10
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return e[k]; }
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
return Object.freeze(n);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var FilePlayer$2 = {};
|
|
22
|
-
|
|
23
|
-
(function (exports) {
|
|
24
|
-
|
|
25
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
26
|
-
|
|
27
|
-
Object.defineProperty(exports, "__esModule", {
|
|
28
|
-
value: true
|
|
29
|
-
});
|
|
30
|
-
exports["default"] = void 0;
|
|
31
|
-
|
|
32
|
-
var _react = _interopRequireWildcard(require$$0);
|
|
33
|
-
|
|
34
|
-
var _utils = components_Video_VideoPlayer.utils;
|
|
35
|
-
|
|
36
|
-
var _patterns = components_Video_VideoPlayer.patterns;
|
|
37
|
-
|
|
38
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
39
|
-
|
|
40
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
|
-
|
|
42
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
43
|
-
|
|
44
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
45
|
-
|
|
46
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
47
|
-
|
|
48
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
49
|
-
|
|
50
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
51
|
-
|
|
52
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
53
|
-
|
|
54
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
55
|
-
|
|
56
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
57
|
-
|
|
58
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
59
|
-
|
|
60
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
|
-
|
|
62
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
63
|
-
|
|
64
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
65
|
-
|
|
66
|
-
var HAS_NAVIGATOR = typeof navigator !== 'undefined';
|
|
67
|
-
var IS_IPAD_PRO = HAS_NAVIGATOR && navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
68
|
-
var IS_IOS = HAS_NAVIGATOR && (/iPad|iPhone|iPod/.test(navigator.userAgent) || IS_IPAD_PRO) && !window.MSStream;
|
|
69
|
-
var HLS_SDK_URL = 'https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js';
|
|
70
|
-
var HLS_GLOBAL = 'Hls';
|
|
71
|
-
var DASH_SDK_URL = 'https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js';
|
|
72
|
-
var DASH_GLOBAL = 'dashjs';
|
|
73
|
-
var FLV_SDK_URL = 'https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js';
|
|
74
|
-
var FLV_GLOBAL = 'flvjs';
|
|
75
|
-
var MATCH_DROPBOX_URL = /www\.dropbox\.com\/.+/;
|
|
76
|
-
var MATCH_CLOUDFLARE_STREAM = /https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/;
|
|
77
|
-
var REPLACE_CLOUDFLARE_STREAM = 'https://videodelivery.net/{id}/manifest/video.m3u8';
|
|
78
|
-
|
|
79
|
-
var FilePlayer = /*#__PURE__*/function (_Component) {
|
|
80
|
-
_inherits(FilePlayer, _Component);
|
|
81
|
-
|
|
82
|
-
var _super = _createSuper(FilePlayer);
|
|
83
|
-
|
|
84
|
-
function FilePlayer() {
|
|
85
|
-
var _this;
|
|
86
|
-
|
|
87
|
-
_classCallCheck(this, FilePlayer);
|
|
88
|
-
|
|
89
|
-
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
90
|
-
_args[_key] = arguments[_key];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
_this = _super.call.apply(_super, [this].concat(_args));
|
|
94
|
-
|
|
95
|
-
_defineProperty(_assertThisInitialized(_this), "onReady", function () {
|
|
96
|
-
var _this$props;
|
|
97
|
-
|
|
98
|
-
return (_this$props = _this.props).onReady.apply(_this$props, arguments);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
_defineProperty(_assertThisInitialized(_this), "onPlay", function () {
|
|
102
|
-
var _this$props2;
|
|
103
|
-
|
|
104
|
-
return (_this$props2 = _this.props).onPlay.apply(_this$props2, arguments);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "onBuffer", function () {
|
|
108
|
-
var _this$props3;
|
|
109
|
-
|
|
110
|
-
return (_this$props3 = _this.props).onBuffer.apply(_this$props3, arguments);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
_defineProperty(_assertThisInitialized(_this), "onBufferEnd", function () {
|
|
114
|
-
var _this$props4;
|
|
115
|
-
|
|
116
|
-
return (_this$props4 = _this.props).onBufferEnd.apply(_this$props4, arguments);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
_defineProperty(_assertThisInitialized(_this), "onPause", function () {
|
|
120
|
-
var _this$props5;
|
|
121
|
-
|
|
122
|
-
return (_this$props5 = _this.props).onPause.apply(_this$props5, arguments);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
_defineProperty(_assertThisInitialized(_this), "onEnded", function () {
|
|
126
|
-
var _this$props6;
|
|
127
|
-
|
|
128
|
-
return (_this$props6 = _this.props).onEnded.apply(_this$props6, arguments);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
_defineProperty(_assertThisInitialized(_this), "onError", function () {
|
|
132
|
-
var _this$props7;
|
|
133
|
-
|
|
134
|
-
return (_this$props7 = _this.props).onError.apply(_this$props7, arguments);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
_defineProperty(_assertThisInitialized(_this), "onPlayBackRateChange", function (event) {
|
|
138
|
-
return _this.props.onPlaybackRateChange(event.target.playbackRate);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
_defineProperty(_assertThisInitialized(_this), "onEnablePIP", function () {
|
|
142
|
-
var _this$props8;
|
|
143
|
-
|
|
144
|
-
return (_this$props8 = _this.props).onEnablePIP.apply(_this$props8, arguments);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
_defineProperty(_assertThisInitialized(_this), "onDisablePIP", function (e) {
|
|
148
|
-
var _this$props9 = _this.props,
|
|
149
|
-
onDisablePIP = _this$props9.onDisablePIP,
|
|
150
|
-
playing = _this$props9.playing;
|
|
151
|
-
onDisablePIP(e);
|
|
152
|
-
|
|
153
|
-
if (playing) {
|
|
154
|
-
_this.play();
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
_defineProperty(_assertThisInitialized(_this), "onPresentationModeChange", function (e) {
|
|
159
|
-
if (_this.player && (0, _utils.supportsWebKitPresentationMode)(_this.player)) {
|
|
160
|
-
var webkitPresentationMode = _this.player.webkitPresentationMode;
|
|
161
|
-
|
|
162
|
-
if (webkitPresentationMode === 'picture-in-picture') {
|
|
163
|
-
_this.onEnablePIP(e);
|
|
164
|
-
} else if (webkitPresentationMode === 'inline') {
|
|
165
|
-
_this.onDisablePIP(e);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
_defineProperty(_assertThisInitialized(_this), "onSeek", function (e) {
|
|
171
|
-
_this.props.onSeek(e.target.currentTime);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
_defineProperty(_assertThisInitialized(_this), "mute", function () {
|
|
175
|
-
_this.player.muted = true;
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
_defineProperty(_assertThisInitialized(_this), "unmute", function () {
|
|
179
|
-
_this.player.muted = false;
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
_defineProperty(_assertThisInitialized(_this), "renderSourceElement", function (source, index) {
|
|
183
|
-
if (typeof source === 'string') {
|
|
184
|
-
return /*#__PURE__*/_react["default"].createElement("source", {
|
|
185
|
-
key: index,
|
|
186
|
-
src: source
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return /*#__PURE__*/_react["default"].createElement("source", _extends({
|
|
191
|
-
key: index
|
|
192
|
-
}, source));
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
_defineProperty(_assertThisInitialized(_this), "renderTrack", function (track, index) {
|
|
196
|
-
return /*#__PURE__*/_react["default"].createElement("track", _extends({
|
|
197
|
-
key: index
|
|
198
|
-
}, track));
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
_defineProperty(_assertThisInitialized(_this), "ref", function (player) {
|
|
202
|
-
if (_this.player) {
|
|
203
|
-
// Store previous player to be used by removeListeners()
|
|
204
|
-
_this.prevPlayer = _this.player;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
_this.player = player;
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
return _this;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
_createClass(FilePlayer, [{
|
|
214
|
-
key: "componentDidMount",
|
|
215
|
-
value: function componentDidMount() {
|
|
216
|
-
this.props.onMount && this.props.onMount(this);
|
|
217
|
-
this.addListeners(this.player);
|
|
218
|
-
|
|
219
|
-
if (IS_IOS) {
|
|
220
|
-
this.player.load();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}, {
|
|
224
|
-
key: "componentDidUpdate",
|
|
225
|
-
value: function componentDidUpdate(prevProps) {
|
|
226
|
-
if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) {
|
|
227
|
-
this.removeListeners(this.prevPlayer, prevProps.url);
|
|
228
|
-
this.addListeners(this.player);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (this.props.url !== prevProps.url && !(0, _utils.isMediaStream)(this.props.url)) {
|
|
232
|
-
this.player.srcObject = null;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}, {
|
|
236
|
-
key: "componentWillUnmount",
|
|
237
|
-
value: function componentWillUnmount() {
|
|
238
|
-
this.removeListeners(this.player);
|
|
239
|
-
|
|
240
|
-
if (this.hls) {
|
|
241
|
-
this.hls.destroy();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, {
|
|
245
|
-
key: "addListeners",
|
|
246
|
-
value: function addListeners(player) {
|
|
247
|
-
var _this$props10 = this.props,
|
|
248
|
-
url = _this$props10.url,
|
|
249
|
-
playsinline = _this$props10.playsinline;
|
|
250
|
-
player.addEventListener('play', this.onPlay);
|
|
251
|
-
player.addEventListener('waiting', this.onBuffer);
|
|
252
|
-
player.addEventListener('playing', this.onBufferEnd);
|
|
253
|
-
player.addEventListener('pause', this.onPause);
|
|
254
|
-
player.addEventListener('seeked', this.onSeek);
|
|
255
|
-
player.addEventListener('ended', this.onEnded);
|
|
256
|
-
player.addEventListener('error', this.onError);
|
|
257
|
-
player.addEventListener('ratechange', this.onPlayBackRateChange);
|
|
258
|
-
player.addEventListener('enterpictureinpicture', this.onEnablePIP);
|
|
259
|
-
player.addEventListener('leavepictureinpicture', this.onDisablePIP);
|
|
260
|
-
player.addEventListener('webkitpresentationmodechanged', this.onPresentationModeChange);
|
|
261
|
-
|
|
262
|
-
if (!this.shouldUseHLS(url)) {
|
|
263
|
-
// onReady is handled by hls.js
|
|
264
|
-
player.addEventListener('canplay', this.onReady);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (playsinline) {
|
|
268
|
-
player.setAttribute('playsinline', '');
|
|
269
|
-
player.setAttribute('webkit-playsinline', '');
|
|
270
|
-
player.setAttribute('x5-playsinline', '');
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
key: "removeListeners",
|
|
275
|
-
value: function removeListeners(player, url) {
|
|
276
|
-
player.removeEventListener('canplay', this.onReady);
|
|
277
|
-
player.removeEventListener('play', this.onPlay);
|
|
278
|
-
player.removeEventListener('waiting', this.onBuffer);
|
|
279
|
-
player.removeEventListener('playing', this.onBufferEnd);
|
|
280
|
-
player.removeEventListener('pause', this.onPause);
|
|
281
|
-
player.removeEventListener('seeked', this.onSeek);
|
|
282
|
-
player.removeEventListener('ended', this.onEnded);
|
|
283
|
-
player.removeEventListener('error', this.onError);
|
|
284
|
-
player.removeEventListener('ratechange', this.onPlayBackRateChange);
|
|
285
|
-
player.removeEventListener('enterpictureinpicture', this.onEnablePIP);
|
|
286
|
-
player.removeEventListener('leavepictureinpicture', this.onDisablePIP);
|
|
287
|
-
player.removeEventListener('webkitpresentationmodechanged', this.onPresentationModeChange);
|
|
288
|
-
|
|
289
|
-
if (!this.shouldUseHLS(url)) {
|
|
290
|
-
// onReady is handled by hls.js
|
|
291
|
-
player.removeEventListener('canplay', this.onReady);
|
|
292
|
-
}
|
|
293
|
-
} // Proxy methods to prevent listener leaks
|
|
294
|
-
|
|
295
|
-
}, {
|
|
296
|
-
key: "shouldUseAudio",
|
|
297
|
-
value: function shouldUseAudio(props) {
|
|
298
|
-
if (props.config.forceVideo) {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (props.config.attributes.poster) {
|
|
303
|
-
return false; // Use <video> so that poster is shown
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return _patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio;
|
|
307
|
-
}
|
|
308
|
-
}, {
|
|
309
|
-
key: "shouldUseHLS",
|
|
310
|
-
value: function shouldUseHLS(url) {
|
|
311
|
-
if (this.props.config.forceHLS) {
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (IS_IOS) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return _patterns.HLS_EXTENSIONS.test(url) || MATCH_CLOUDFLARE_STREAM.test(url);
|
|
320
|
-
}
|
|
321
|
-
}, {
|
|
322
|
-
key: "shouldUseDASH",
|
|
323
|
-
value: function shouldUseDASH(url) {
|
|
324
|
-
return _patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH;
|
|
325
|
-
}
|
|
326
|
-
}, {
|
|
327
|
-
key: "shouldUseFLV",
|
|
328
|
-
value: function shouldUseFLV(url) {
|
|
329
|
-
return _patterns.FLV_EXTENSIONS.test(url) || this.props.config.forceFLV;
|
|
330
|
-
}
|
|
331
|
-
}, {
|
|
332
|
-
key: "load",
|
|
333
|
-
value: function load(url) {
|
|
334
|
-
var _this2 = this;
|
|
335
|
-
|
|
336
|
-
var _this$props$config = this.props.config,
|
|
337
|
-
hlsVersion = _this$props$config.hlsVersion,
|
|
338
|
-
hlsOptions = _this$props$config.hlsOptions,
|
|
339
|
-
dashVersion = _this$props$config.dashVersion,
|
|
340
|
-
flvVersion = _this$props$config.flvVersion;
|
|
341
|
-
|
|
342
|
-
if (this.hls) {
|
|
343
|
-
this.hls.destroy();
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (this.dash) {
|
|
347
|
-
this.dash.reset();
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (this.shouldUseHLS(url)) {
|
|
351
|
-
(0, _utils.getSDK)(HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(function (Hls) {
|
|
352
|
-
_this2.hls = new Hls(hlsOptions);
|
|
353
|
-
|
|
354
|
-
_this2.hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
|
355
|
-
_this2.props.onReady();
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
_this2.hls.on(Hls.Events.ERROR, function (e, data) {
|
|
359
|
-
_this2.props.onError(e, data, _this2.hls, Hls);
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
if (MATCH_CLOUDFLARE_STREAM.test(url)) {
|
|
363
|
-
var id = url.match(MATCH_CLOUDFLARE_STREAM)[1];
|
|
364
|
-
|
|
365
|
-
_this2.hls.loadSource(REPLACE_CLOUDFLARE_STREAM.replace('{id}', id));
|
|
366
|
-
} else {
|
|
367
|
-
_this2.hls.loadSource(url);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
_this2.hls.attachMedia(_this2.player);
|
|
371
|
-
|
|
372
|
-
_this2.props.onLoaded();
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if (this.shouldUseDASH(url)) {
|
|
377
|
-
(0, _utils.getSDK)(DASH_SDK_URL.replace('VERSION', dashVersion), DASH_GLOBAL).then(function (dashjs) {
|
|
378
|
-
_this2.dash = dashjs.MediaPlayer().create();
|
|
379
|
-
|
|
380
|
-
_this2.dash.initialize(_this2.player, url, _this2.props.playing);
|
|
381
|
-
|
|
382
|
-
_this2.dash.on('error', _this2.props.onError);
|
|
383
|
-
|
|
384
|
-
if (parseInt(dashVersion) < 3) {
|
|
385
|
-
_this2.dash.getDebug().setLogToBrowserConsole(false);
|
|
386
|
-
} else {
|
|
387
|
-
_this2.dash.updateSettings({
|
|
388
|
-
debug: {
|
|
389
|
-
logLevel: dashjs.Debug.LOG_LEVEL_NONE
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
_this2.props.onLoaded();
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if (this.shouldUseFLV(url)) {
|
|
399
|
-
(0, _utils.getSDK)(FLV_SDK_URL.replace('VERSION', flvVersion), FLV_GLOBAL).then(function (flvjs) {
|
|
400
|
-
_this2.flv = flvjs.createPlayer({
|
|
401
|
-
type: 'flv',
|
|
402
|
-
url: url
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
_this2.flv.attachMediaElement(_this2.player);
|
|
406
|
-
|
|
407
|
-
_this2.flv.on(flvjs.Events.ERROR, function (e, data) {
|
|
408
|
-
_this2.props.onError(e, data, _this2.flv, flvjs);
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
_this2.flv.load();
|
|
412
|
-
|
|
413
|
-
_this2.props.onLoaded();
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (url instanceof Array) {
|
|
418
|
-
// When setting new urls (<source>) on an already loaded video,
|
|
419
|
-
// HTMLMediaElement.load() is needed to reset the media element
|
|
420
|
-
// and restart the media resource. Just replacing children source
|
|
421
|
-
// dom nodes is not enough
|
|
422
|
-
this.player.load();
|
|
423
|
-
} else if ((0, _utils.isMediaStream)(url)) {
|
|
424
|
-
try {
|
|
425
|
-
this.player.srcObject = url;
|
|
426
|
-
} catch (e) {
|
|
427
|
-
this.player.src = window.URL.createObjectURL(url);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}, {
|
|
432
|
-
key: "play",
|
|
433
|
-
value: function play() {
|
|
434
|
-
var promise = this.player.play();
|
|
435
|
-
|
|
436
|
-
if (promise) {
|
|
437
|
-
promise["catch"](this.props.onError);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}, {
|
|
441
|
-
key: "pause",
|
|
442
|
-
value: function pause() {
|
|
443
|
-
this.player.pause();
|
|
444
|
-
}
|
|
445
|
-
}, {
|
|
446
|
-
key: "stop",
|
|
447
|
-
value: function stop() {
|
|
448
|
-
this.player.removeAttribute('src');
|
|
449
|
-
|
|
450
|
-
if (this.dash) {
|
|
451
|
-
this.dash.reset();
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}, {
|
|
455
|
-
key: "seekTo",
|
|
456
|
-
value: function seekTo(seconds) {
|
|
457
|
-
this.player.currentTime = seconds;
|
|
458
|
-
}
|
|
459
|
-
}, {
|
|
460
|
-
key: "setVolume",
|
|
461
|
-
value: function setVolume(fraction) {
|
|
462
|
-
this.player.volume = fraction;
|
|
463
|
-
}
|
|
464
|
-
}, {
|
|
465
|
-
key: "enablePIP",
|
|
466
|
-
value: function enablePIP() {
|
|
467
|
-
if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
|
|
468
|
-
this.player.requestPictureInPicture();
|
|
469
|
-
} else if ((0, _utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== 'picture-in-picture') {
|
|
470
|
-
this.player.webkitSetPresentationMode('picture-in-picture');
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}, {
|
|
474
|
-
key: "disablePIP",
|
|
475
|
-
value: function disablePIP() {
|
|
476
|
-
if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
|
|
477
|
-
document.exitPictureInPicture();
|
|
478
|
-
} else if ((0, _utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== 'inline') {
|
|
479
|
-
this.player.webkitSetPresentationMode('inline');
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}, {
|
|
483
|
-
key: "setPlaybackRate",
|
|
484
|
-
value: function setPlaybackRate(rate) {
|
|
485
|
-
try {
|
|
486
|
-
this.player.playbackRate = rate;
|
|
487
|
-
} catch (error) {
|
|
488
|
-
this.props.onError(error);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}, {
|
|
492
|
-
key: "getDuration",
|
|
493
|
-
value: function getDuration() {
|
|
494
|
-
if (!this.player) return null;
|
|
495
|
-
var _this$player = this.player,
|
|
496
|
-
duration = _this$player.duration,
|
|
497
|
-
seekable = _this$player.seekable; // on iOS, live streams return Infinity for the duration
|
|
498
|
-
// so instead we use the end of the seekable timerange
|
|
499
|
-
|
|
500
|
-
if (duration === Infinity && seekable.length > 0) {
|
|
501
|
-
return seekable.end(seekable.length - 1);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
return duration;
|
|
505
|
-
}
|
|
506
|
-
}, {
|
|
507
|
-
key: "getCurrentTime",
|
|
508
|
-
value: function getCurrentTime() {
|
|
509
|
-
if (!this.player) return null;
|
|
510
|
-
return this.player.currentTime;
|
|
511
|
-
}
|
|
512
|
-
}, {
|
|
513
|
-
key: "getSecondsLoaded",
|
|
514
|
-
value: function getSecondsLoaded() {
|
|
515
|
-
if (!this.player) return null;
|
|
516
|
-
var buffered = this.player.buffered;
|
|
517
|
-
|
|
518
|
-
if (buffered.length === 0) {
|
|
519
|
-
return 0;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
var end = buffered.end(buffered.length - 1);
|
|
523
|
-
var duration = this.getDuration();
|
|
524
|
-
|
|
525
|
-
if (end > duration) {
|
|
526
|
-
return duration;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
return end;
|
|
530
|
-
}
|
|
531
|
-
}, {
|
|
532
|
-
key: "getSource",
|
|
533
|
-
value: function getSource(url) {
|
|
534
|
-
var useHLS = this.shouldUseHLS(url);
|
|
535
|
-
var useDASH = this.shouldUseDASH(url);
|
|
536
|
-
var useFLV = this.shouldUseFLV(url);
|
|
537
|
-
|
|
538
|
-
if (url instanceof Array || (0, _utils.isMediaStream)(url) || useHLS || useDASH || useFLV) {
|
|
539
|
-
return undefined;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
if (MATCH_DROPBOX_URL.test(url)) {
|
|
543
|
-
return url.replace('www.dropbox.com', 'dl.dropboxusercontent.com');
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
return url;
|
|
547
|
-
}
|
|
548
|
-
}, {
|
|
549
|
-
key: "render",
|
|
550
|
-
value: function render() {
|
|
551
|
-
var _this$props11 = this.props,
|
|
552
|
-
url = _this$props11.url,
|
|
553
|
-
playing = _this$props11.playing,
|
|
554
|
-
loop = _this$props11.loop,
|
|
555
|
-
controls = _this$props11.controls,
|
|
556
|
-
muted = _this$props11.muted,
|
|
557
|
-
config = _this$props11.config,
|
|
558
|
-
width = _this$props11.width,
|
|
559
|
-
height = _this$props11.height;
|
|
560
|
-
var useAudio = this.shouldUseAudio(this.props);
|
|
561
|
-
var Element = useAudio ? 'audio' : 'video';
|
|
562
|
-
var style = {
|
|
563
|
-
width: width === 'auto' ? width : '100%',
|
|
564
|
-
height: height === 'auto' ? height : '100%'
|
|
565
|
-
};
|
|
566
|
-
return /*#__PURE__*/_react["default"].createElement(Element, _extends({
|
|
567
|
-
ref: this.ref,
|
|
568
|
-
src: this.getSource(url),
|
|
569
|
-
style: style,
|
|
570
|
-
preload: "auto",
|
|
571
|
-
autoPlay: playing || undefined,
|
|
572
|
-
controls: controls,
|
|
573
|
-
muted: muted,
|
|
574
|
-
loop: loop
|
|
575
|
-
}, config.attributes), url instanceof Array && url.map(this.renderSourceElement), config.tracks.map(this.renderTrack));
|
|
576
|
-
}
|
|
577
|
-
}]);
|
|
578
|
-
|
|
579
|
-
return FilePlayer;
|
|
580
|
-
}(_react.Component);
|
|
581
|
-
|
|
582
|
-
exports["default"] = FilePlayer;
|
|
583
|
-
|
|
584
|
-
_defineProperty(FilePlayer, "displayName", 'FilePlayer');
|
|
585
|
-
|
|
586
|
-
_defineProperty(FilePlayer, "canPlay", _patterns.canPlay.file);
|
|
587
|
-
} (FilePlayer$2));
|
|
588
|
-
|
|
589
|
-
var FilePlayer = /*@__PURE__*/components_Video_VideoPlayer.getDefaultExportFromCjs(FilePlayer$2);
|
|
590
|
-
|
|
591
|
-
var FilePlayer$1 = /*#__PURE__*/_mergeNamespaces({
|
|
592
|
-
__proto__: null,
|
|
593
|
-
default: FilePlayer
|
|
594
|
-
}, [FilePlayer$2]);
|
|
595
|
-
|
|
596
|
-
exports.FilePlayer = FilePlayer$1;
|