videojs / videojs-contrib-eme

Supports Encrypted Media Extensions for playback of encrypted content in Video.js
Other
203 stars 72 forks source link

Unsupported keysystem or supportedconfigurations #211

Open iamharshitpandeyy opened 6 months ago

iamharshitpandeyy commented 6 months ago

I creating Electron Application in which if I pass keyStreams because of DRM protection it's show this error "Unsupported keysystem or supportedconfigurations " Same configuration working on my React application

import videojs from "video.js";
import "video.js/dist/video-js.css";
import "videojs-contrib-quality-levels";
import "videojs-contrib-eme";
import "videojs-http-quality-selector";
import "dashjs";
import "videojs-hotkeys";
import "videojs-seek-buttons";
import "videojs-seek-buttons/dist/videojs-seek-buttons.css";

 const sources = [];
  if (browser === "Safari") {
    sources.push({
      src: hlsUrl,
      keySystems: {
        "com.apple.fps.1_0": {
          certificateUri: < certificateuri >,
          getContentId: function (emeOptions, initData) {
            return new TextDecoder().decode(
              initData.filter((item) => item !== 0 && item !== 150)
            );
          },
          licenseUri: < Licence Uri >
          licenseHeaders: {
            "X-AxDrm-Message": HlsDrmToken,
          },
        },
      },
    });
  } else {
    sources.push({
      src: url,
      type: "application/dash+xml",
      keySystems: {
        "com.widevine.alpha": {
          url: <url>,
          licenseHeaders: {
            "X-AxDRM-Message": drmToken,
          },
        },
      },
    });
  }

  const videoOptions = {
    autoplay: false,
    preload: "metadata",
    controls: true,
    playbackRates: [0.5, 1, 1.5, 2],
    poster: "",
    sources: sources,
    plugins: {
      hotkeys: {
        enableModifiersForNumbers: false,
        seekStep: 10,
        volumeStep: 0.1,
        enableVolumeScroll: false,
      },
    },
    html5: {
      nativeAudioTracks: true,
      nativeVideoTracks: true,
      nativeTextTracks: true,
    },
  };