@eluvio/elv-player-js 2.0.4 → 2.0.5

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.
@@ -756,12 +756,36 @@ export class EluvioPlayer {
756
756
  versionHash: this.contentHash
757
757
  });
758
758
 
759
+ if(!audit.verified) {
760
+ return;
761
+ }
762
+
759
763
  audit.verifiedAt = Date.now();
760
764
 
765
+ const objectId = client.utils.DecodeVersionHash(this.contentHash).objectId;
766
+ audit.details = {
767
+ _full: false,
768
+ versionHash: this.contentHash,
769
+ objectId,
770
+ address: client.utils.HashToAddress(objectId),
771
+ signatureMethod: "ECDSA secp256k1"
772
+ };
773
+
774
+ this.contentAudit = audit;
775
+ this.contentVerified = audit.verified;
776
+
777
+ this.__SettingsUpdate();
778
+ }
779
+
780
+ async __LoadVerificationDetails() {
781
+ if(!this.contentHash || !this.contentAudit || this.contentAudit.details._full) { return; }
782
+
783
+ const client = await this.__Client();
784
+
761
785
  const objectId = client.utils.DecodeVersionHash(this.contentHash).objectId;
762
786
  const tenantId = await client.ContentObjectTenantId({objectId});
763
787
 
764
- let tenantName, lastCommittedAt;
788
+ let tenantName, lastCommittedAt, versionCount, latestTransactionHash, latestTransactionHashUrl;
765
789
  try {
766
790
  lastCommittedAt = await client.CallContractMethod({
767
791
  contractAddress: client.utils.HashToAddress(objectId),
@@ -771,7 +795,17 @@ export class EluvioPlayer {
771
795
  if(lastCommittedAt) {
772
796
  lastCommittedAt = new Date(parseInt(lastCommittedAt._hex, 16) * 1000);
773
797
  }
774
- // eslint-disable-next-line no-empty
798
+
799
+ versionCount = await client.CallContractMethod({
800
+ contractAddress: client.utils.HashToAddress(objectId),
801
+ methodName: "countVersionHashes"
802
+ });
803
+
804
+ if(versionCount) {
805
+ versionCount = parseInt(versionCount._hex, 16);
806
+ }
807
+
808
+ // eslint-disable-next-line no-empty
775
809
  } catch(error) {}
776
810
 
777
811
  try {
@@ -780,10 +814,25 @@ export class EluvioPlayer {
780
814
  objectId: tenantId.replace("iten", "iq__"),
781
815
  metadataSubtree: "/public/name"
782
816
  });
783
- // eslint-disable-next-line no-empty
817
+ // eslint-disable-next-line no-empty
784
818
  } catch(error) {}
785
819
 
786
- audit.details = {
820
+ try {
821
+ if(client.NetworkInfo().name === "main") {
822
+ const explorerUrl = new URL("https://explorer.contentfabric.io/api");
823
+ explorerUrl.searchParams.set("module", "account");
824
+ explorerUrl.searchParams.set("action", "txlist");
825
+ explorerUrl.searchParams.set("offset", "1");
826
+ explorerUrl.searchParams.set("address", client.utils.HashToAddress(objectId));
827
+
828
+ latestTransactionHash = (await ((await fetch(explorerUrl)).json())).result[0].hash;
829
+ latestTransactionHashUrl = `https://explorer.contentfabric.io/tx/${latestTransactionHash}`;
830
+ }
831
+ // eslint-disable-next-line no-empty
832
+ } catch(error){}
833
+
834
+ this.contentAudit.details = {
835
+ _full: true,
787
836
  versionHash: this.contentHash,
788
837
  objectId,
789
838
  address: client.utils.HashToAddress(objectId),
@@ -792,12 +841,12 @@ export class EluvioPlayer {
792
841
  tenantName,
793
842
  ownerAddress: await client.ContentObjectOwner({objectId}),
794
843
  lastCommittedAt,
844
+ versionCount,
845
+ latestTransactionHash,
846
+ latestTransactionHashUrl,
795
847
  signatureMethod: "ECDSA secp256k1"
796
848
  };
797
849
 
798
- this.contentAudit = audit;
799
- this.contentVerified = audit.verified;
800
-
801
850
  this.__SettingsUpdate();
802
851
  }
803
852
 
@@ -466,6 +466,10 @@
466
466
  overflow: hidden;
467
467
  position: relative;
468
468
  width: 100%;
469
+
470
+ a {
471
+ text-decoration: underline;
472
+ }
469
473
  }
470
474
 
471
475
  &__detail-label {
@@ -483,7 +487,7 @@
483
487
 
484
488
  &__detail-copy {
485
489
  color: var(--color-menu-text-secondary);
486
- height: 25px;
490
+ height: 18px;
487
491
  position: absolute;
488
492
  right: 0;
489
493
 
@@ -595,7 +599,7 @@
595
599
  }
596
600
 
597
601
  &__detail-copy {
598
- height: 20px;
602
+ height: 15px;
599
603
  }
600
604
  }
601
605
  }
@@ -224,6 +224,11 @@
224
224
  .play-pause-button {
225
225
  padding: 0;
226
226
  }
227
+
228
+ .right-control-button {
229
+ height: 35px;
230
+ margin-bottom: 1px;
231
+ }
227
232
  }
228
233
 
229
234
  .time {
@@ -324,6 +324,8 @@ export const CopyButton = ({label, value, className=""}) => {
324
324
  };
325
325
 
326
326
  const ContentDetail = ({label, value, copyable}) => {
327
+ if(!value) { return null; }
328
+
327
329
  return (
328
330
  <div className={CommonStyles["verification-menu__detail"]}>
329
331
  <label className={CommonStyles["verification-menu__detail-label"]}>{label}:</label>
@@ -344,8 +346,12 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
344
346
  const menuRef = createRef();
345
347
  const [audit, setAudit] = useState();
346
348
  const [showDetails, setShowDetails] = useState(false);
349
+ const [_, setLoaded] = useState(false);
347
350
 
348
351
  useEffect(() => {
352
+ player.__LoadVerificationDetails()
353
+ .then(() => setLoaded(true));
354
+
349
355
  const UpdateSettings = () => setAudit(player.controls.ContentVerificationDetails());
350
356
 
351
357
  UpdateSettings();
@@ -426,10 +432,7 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
426
432
  <div className={CommonStyles["verification-menu__details"]}>
427
433
  <ContentDetail label="Content Fabric Object ID" value={audit.details.objectId} copyable />
428
434
  <ContentDetail label="Organization Address" value={audit.details.tenantAddress} copyable />
429
- {
430
- !audit.details.tenantName ? null :
431
- <ContentDetail label="Organization Name" value={audit.details.tenantName} />
432
- }
435
+ <ContentDetail label="Organization Name" value={audit.details.tenantName} />
433
436
  <ContentDetail label="Owner Address" value={audit.details.ownerAddress} copyable />
434
437
  <ContentDetail label="Content Object Contract Address" value={audit.details.address} copyable />
435
438
  <ContentDetail label="Content Version Hash" value={audit.details.versionHash} copyable />
@@ -437,6 +440,18 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
437
440
  !audit.details.lastCommittedAt ? null :
438
441
  <ContentDetail label="Last Commit" value={new Date(audit.details.lastCommittedAt).toLocaleTimeString(navigator.language || "en-us", {year: "numeric", "month": "long", day: "numeric"})} />
439
442
  }
443
+ <ContentDetail label="Versions" value={audit.details.versionCount} />
444
+ {
445
+ !audit.details.latestTransactionHash ? null :
446
+ <ContentDetail
447
+ label="Latest Transaction"
448
+ value={
449
+ <a href={audit.details.latestTransactionHashUrl} target="_blank" rel="noreferrer">
450
+ { audit.details.latestTransactionHash }
451
+ </a>
452
+ }
453
+ />
454
+ }
440
455
  <ContentDetail label="Signature Algorithm" value={audit.details.signatureMethod} />
441
456
  </div>
442
457
  </>
@@ -199,8 +199,8 @@ const PlayerUI = ({target, parameters, InitCallback, ErrorCallback, Unmount, Res
199
199
  tabIndex={0}
200
200
  style={{
201
201
  backgroundColor: parameters.playerOptions.backgroundColor || "transparent",
202
- "--portal-width": `${dimensions.width}px`,
203
- "--portal-height": `${dimensions.height}px`
202
+ "--portal-width": `${shouldRotate ? dimensions.height : dimensions.width}px`,
203
+ "--portal-height": `${shouldRotate ? dimensions.width : dimensions.height}px`
204
204
  }}
205
205
  className={[PlayerStyles["player-container"], shouldRotate ? PlayerStyles["player-container--rotated"] : "", `__eluvio-player--size-${size}`, `__eluvio-player--orientation-${orientation}`].join(" ")}
206
206
  >
@@ -11,9 +11,9 @@ import EluvioPlayerParameters from "../player/PlayerParameters.js";
11
11
  import EluvioLogo from "../static/images/Logo.png";
12
12
  import {CollectionMenu, ContentVerificationMenu, SeekBar, SettingsMenu, VolumeControls} from "./Components.jsx";
13
13
 
14
- export const IconButton = ({icon, ...props}) => {
14
+ export const IconButton = ({icon, className="", ...props}) => {
15
15
  return (
16
- <button {...props} className={`${ControlStyles["icon-button"]} ${props.className || ""}`} dangerouslySetInnerHTML={{__html: icon}} />
16
+ <button {...props} className={`${ControlStyles["icon-button"]} ${className}`} dangerouslySetInnerHTML={{__html: icon}} />
17
17
  );
18
18
  };
19
19
 
@@ -279,6 +279,7 @@ const WebControls = ({player, playbackStarted, canPlay, recentlyInteracted, setR
279
279
  aria-label="Rotate Video"
280
280
  icon={Icons.RotateIcon}
281
281
  onClick={() => player.controls.SetAllowRotation(!player.controls.AllowRotation())}
282
+ className={ControlStyles["right-control-button"]}
282
283
  />
283
284
  }
284
285
  {
@@ -295,6 +296,7 @@ const WebControls = ({player, playbackStarted, canPlay, recentlyInteracted, setR
295
296
  aria-label={videoState.fullscreen ? "Exit Fullscreen" : "Fullscreen"}
296
297
  icon={videoState.fullscreen ? Icons.ExitFullscreenIcon : Icons.FullscreenIcon}
297
298
  onClick={() => player.controls.ToggleFullscreen()}
299
+ className={ControlStyles["right-control-button"]}
298
300
  />
299
301
  </div>
300
302
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "![Eluvio Logo](lib/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",