@elice/material-video-file 1.240612.0 → 1.240614.0-cloudflare.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.
@@ -56,6 +56,7 @@ const MaterialVideoFile = _a => {
56
56
  materialVideoFile: materialVideoFile !== null && materialVideoFile !== void 0 ? materialVideoFile : null,
57
57
  materialVideoFileStatus: materialVideoFileStatus,
58
58
  accountApi: accountApi,
59
+ // TODO: change to cloudflareStream
59
60
  title: (_c = (_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.videoAssetName) !== null && _c !== void 0 ? _c : undefined
60
61
  }))));
61
62
  };
@@ -63,16 +63,36 @@ const MaterialVideoFilePlayer = ({
63
63
  * Current video status.
64
64
  */
65
65
  const materialVideoFileUploadStatus = React.useMemo(() => {
66
- var _a, _b, _c, _d;
67
- switch (true) {
68
- case typeof ((_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.status) === 'undefined':
69
- return VideoUploadStatus.Empty;
70
- case ((_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === types.enums.AzureMediaVideoStatus.Encoding:
66
+ var _a, _b, _c;
67
+ // empty
68
+ if (typeof ((_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.cloudflareStream) === null || _a === void 0 ? void 0 : _a.status) === 'undefined' && typeof ((_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === 'undefined') {
69
+ return VideoUploadStatus.Empty;
70
+ }
71
+ //
72
+ // Cloudflare Stream
73
+ //
74
+ if (materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.cloudflareStream) {
75
+ switch (materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.cloudflareStream.status) {
76
+ case types.enums.CloudflareStreamStatus.Uploaded:
77
+ return VideoUploadStatus.Encoding;
78
+ case types.enums.CloudflareStreamStatus.EncodeFailed:
79
+ return VideoUploadStatus.EncodingFailed;
80
+ case types.enums.CloudflareStreamStatus.Encoded:
81
+ return typeof materialVideoFile.cloudflareStream.downloadUrl === 'string' ? VideoUploadStatus.Ready : VideoUploadStatus.Empty;
82
+ default:
83
+ return VideoUploadStatus.Empty;
84
+ }
85
+ }
86
+ //
87
+ // Azure Media Video
88
+ //
89
+ switch ((_c = materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.status) {
90
+ case types.enums.AzureMediaVideoStatus.Encoding:
71
91
  return VideoUploadStatus.Encoding;
72
- case ((_c = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.status) === types.enums.AzureMediaVideoStatus.Error:
92
+ case types.enums.AzureMediaVideoStatus.Error:
73
93
  return VideoUploadStatus.EncodingFailed;
74
- case ((_d = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _d === void 0 ? void 0 : _d.status) === types.enums.AzureMediaVideoStatus.Done && typeof materialVideoFile.azureMediaVideo.videoStreamingUrl === 'string':
75
- return VideoUploadStatus.Ready;
94
+ case types.enums.AzureMediaVideoStatus.Done:
95
+ return typeof materialVideoFile.azureMediaVideo.videoStreamingUrl === 'string' ? VideoUploadStatus.Ready : VideoUploadStatus.Empty;
76
96
  default:
77
97
  return VideoUploadStatus.Empty;
78
98
  }
@@ -52,6 +52,7 @@ const MaterialVideoFile = _a => {
52
52
  materialVideoFile: materialVideoFile !== null && materialVideoFile !== void 0 ? materialVideoFile : null,
53
53
  materialVideoFileStatus: materialVideoFileStatus,
54
54
  accountApi: accountApi,
55
+ // TODO: change to cloudflareStream
55
56
  title: (_c = (_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.videoAssetName) !== null && _c !== void 0 ? _c : undefined
56
57
  }))));
57
58
  };
@@ -59,16 +59,36 @@ const MaterialVideoFilePlayer = ({
59
59
  * Current video status.
60
60
  */
61
61
  const materialVideoFileUploadStatus = React.useMemo(() => {
62
- var _a, _b, _c, _d;
63
- switch (true) {
64
- case typeof ((_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.status) === 'undefined':
65
- return VideoUploadStatus.Empty;
66
- case ((_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === enums.AzureMediaVideoStatus.Encoding:
62
+ var _a, _b, _c;
63
+ // empty
64
+ if (typeof ((_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.cloudflareStream) === null || _a === void 0 ? void 0 : _a.status) === 'undefined' && typeof ((_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === 'undefined') {
65
+ return VideoUploadStatus.Empty;
66
+ }
67
+ //
68
+ // Cloudflare Stream
69
+ //
70
+ if (materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.cloudflareStream) {
71
+ switch (materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.cloudflareStream.status) {
72
+ case enums.CloudflareStreamStatus.Uploaded:
73
+ return VideoUploadStatus.Encoding;
74
+ case enums.CloudflareStreamStatus.EncodeFailed:
75
+ return VideoUploadStatus.EncodingFailed;
76
+ case enums.CloudflareStreamStatus.Encoded:
77
+ return typeof materialVideoFile.cloudflareStream.downloadUrl === 'string' ? VideoUploadStatus.Ready : VideoUploadStatus.Empty;
78
+ default:
79
+ return VideoUploadStatus.Empty;
80
+ }
81
+ }
82
+ //
83
+ // Azure Media Video
84
+ //
85
+ switch ((_c = materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.status) {
86
+ case enums.AzureMediaVideoStatus.Encoding:
67
87
  return VideoUploadStatus.Encoding;
68
- case ((_c = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.status) === enums.AzureMediaVideoStatus.Error:
88
+ case enums.AzureMediaVideoStatus.Error:
69
89
  return VideoUploadStatus.EncodingFailed;
70
- case ((_d = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _d === void 0 ? void 0 : _d.status) === enums.AzureMediaVideoStatus.Done && typeof materialVideoFile.azureMediaVideo.videoStreamingUrl === 'string':
71
- return VideoUploadStatus.Ready;
90
+ case enums.AzureMediaVideoStatus.Done:
91
+ return typeof materialVideoFile.azureMediaVideo.videoStreamingUrl === 'string' ? VideoUploadStatus.Ready : VideoUploadStatus.Empty;
72
92
  default:
73
93
  return VideoUploadStatus.Empty;
74
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-video-file",
3
- "version": "1.240612.0",
3
+ "version": "1.240614.0-cloudflare.0",
4
4
  "description": "User view and editing components of Elice material video file",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -44,16 +44,16 @@
44
44
  "tslib": "^2.6.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@elice/api-client": "^1.230815.0",
47
+ "@elice/api-client": "1.240612.0-cloudflare.0",
48
48
  "@elice/blocks": "^1.240514.0",
49
49
  "@elice/design-tokens": "^1.220803.0",
50
50
  "@elice/icons": "^1.230814.0",
51
51
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
52
52
  "@elice/intl": "0.240425.0-rc.2",
53
- "@elice/material-shared-types": "1.240612.0",
54
- "@elice/material-shared-utils": "1.240612.0",
53
+ "@elice/material-shared-types": "1.240614.0-cloudflare.0",
54
+ "@elice/material-shared-utils": "1.240614.0-cloudflare.0",
55
55
  "@elice/openapi-client-account": "^1.230814.0",
56
- "@elice/types": "^1.240208.0",
56
+ "@elice/types": "1.240527.0-cloudflare.2",
57
57
  "@types/classnames": "^2.3.1",
58
58
  "@types/query-string": "^6.3.0",
59
59
  "@types/react": "~17.0.9",
@@ -62,5 +62,5 @@
62
62
  "react-use": "^17.2.4",
63
63
  "styled-components": "^5.3.0"
64
64
  },
65
- "gitHead": "daade4b7db7cef4b9f134988c8165dbd68a6fc82"
65
+ "gitHead": "5bbe89e1c936c1a1027482b3840f7fa9763ccdb9"
66
66
  }