ǩomal
ǩomal

Reputation: 1

Play webm video with ClearKey EME in android tv (version 8) Event Listener "encrypted" is not getting triggered

i have defined

videoElement.addEventListener("encrypted", handleEncrypted),

also i have defined in video tag

 <video
              onEncrypted={handleEncrypted}
              onEncryptedCapture={handleEncrypted}
              ref={(myRef) => {
                video = myRef;
              }}
              disablePictureInPicture
              width="100%"
              className=" minHeight-100 height-100 width-100 objectFill borderRadius0"
              autoPlay
              id="video1"
              src={fileUrl}
            >
              <p>This browser does not support the video element.</p>
            </video>

but handleEncrypted function is not being called aftter the videoElement.setMediaKeys is done in the elow code.

 useEffect(() => {
    var videoElement: any = document.getElementById(
      "video1"
    ) as HTMLVideoElement;
    const setMediaKeys = async () => {
      try {
        if (!videoElement) {
          renderToast({
            severity: "success",
            summary: "success",
            detail: "Video element not found.",
          });
          return;
        }
        if (videoElement) {
          videoElement.addEventListener("encrypted", handleEncrypted);
        }
        const keySystemAccess = await navigator.requestMediaKeySystemAccess(
          "org.w3.clearkey",
          config
        );
        const createdMediaKeys = await keySystemAccess.createMediaKeys();
        if (videoElement.mediaKeys !== null) {
          await videoElement.setMediaKeys(null);
        }
        if (fileUrl && fileUrl !== undefined) {
          await videoElement.setMediaKeys(createdMediaKeys);
        }
      } catch (error) {
        console.error("Failed to set MediaKeys:", error);
      }
    };
    if (licData.id === "VsNuguU3zPXIIekuXy3B") {
    } else {
      setMediaKeys();
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [fileUrl]);

is all the desktop os and webs it is working, but in some android devices like mostly android 8 versiom TV is not triggereing handleEncrypted funtion and thats the reason my video is not playing.

please help me any way to get whats the exact issue, is it bcos webview or any thing.Help me to decrpt the video and play

Upvotes: 0

Views: 63

Answers (0)

Related Questions