VideoHelp Forum




+ Reply to Thread
Results 1 to 2 of 2
  1. Hi have a local html page to load my mpd manifest with a clearkey but it works only in firefox while in edge and chrome the channel doesn't load. If I load the page on a local server the page work correctly. Anybody knows why chrome and edge have this behaviour?

    Code:
    <html>
    <head>
    <!-- for non-UI builds: -->
    <script src="https://ajax.googleapis.com/ajax/libs/shaka-player/4.5.0/shaka-player.compiled.js"></script>
    <!-- or, for UI builds: -->
    <script src="https://ajax.googleapis.com/ajax/libs/shaka-player/4.5.0/shaka-player.ui.js"></script>
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/shaka-player/4.5.0/controls.css">
      <style>
        body {
            width:100%;
            height: 100%;
            font-family: Poppins;
            display:block;
            position: absolute;
            padding: 0px;
            margin: 0px;
            background: #000;
        }
        video{
            width:100%;
            height: 100%;
            display:inline-block;
            -webkit-user-select:none;
            -moz-user-select:none;
            -ms-user-select:none;
            user-select:none;
        }
     a, a:hover, a:focus, a:active {
          text-decoration: none;
     }
    </style>
        <style>
            div a img{visibility:hidden;}
    body::before {
            position: absolute;
            top: 5px;
            right: 5px;
            z-index: 10;
            content: '';
            height: 70px;
            width: 110px;
            background: url(' ') no-repeat;
            background-size: 110px auto, auto;
            opacity: 0.4;
        }
    </style>
    </head>
    <body>
    <center>   <div data-shaka-player-container style="max-width:40em"
             data-shaka-player-cast-receiver-id="1BA79154">
           <!-- The data-shaka-player tag will make the UI library use this video element.
                If no video is provided, the UI will automatically make one inside the container div. -->
             
            <video autoplay data-shaka-player id="video" poster="" style="width:100%;height:100%"></video>
        </div>
        </div></center>
    <script>
    
    const manifestUri =
        'manifest.mpd';
    
    async function init() {
      // When using the UI, the player is made automatically by the UI object.
      const video = document.getElementById('video');
      const ui = video['ui'];
      const controls = ui.getControls();
      const player = controls.getPlayer();
    
    player.configure({
      drm: {
        clearKeys: {
           'kid in hex': 'key in hex',
        }
      }
    });
    
      // Attach player and ui to the window to make it easy to access in the JS console.
      window.player = player;
      window.ui = ui;
    
      // Listen for error events.
      player.addEventListener('error', onPlayerErrorEvent);
      controls.addEventListener('error', onUIErrorEvent);
    
      // Try to load a manifest.
      // This is an asynchronous process.
      try {
        await player.load(manifestUri);
        // This runs if the asynchronous load is successful.
        console.log('The video has now been loaded!');
      } catch (error) {
        onPlayerError(error);
      }
    }
    
    function onPlayerErrorEvent(errorEvent) {
      // Extract the shaka.util.Error object from the event.
      onPlayerError(event.detail);
    }
    
    function onPlayerError(error) {
      // Handle player error
      console.error('Error code', error.code, 'object', error);
    }
    
    function onUIErrorEvent(errorEvent) {
      // Extract the shaka.util.Error object from the event.
      onPlayerError(event.detail);
    }
    
    function initFailed(errorEvent) {
      // Handle the failure to load; errorEvent.detail.reasonCode has a
      // shaka.ui.FailReasonCode describing why.
      console.error('Unable to load the UI library!');
    }
    
    // Listen to the custom shaka-ui-loaded event, to wait until the UI is loaded.
    document.addEventListener('shaka-ui-loaded', init);
    // Listen to the custom shaka-ui-load-failed event, in case Shaka Player fails
    // to load (e.g. due to lack of browser support).
    document.addEventListener('shaka-ui-load-failed', initFailed);
       </script>
    </body>
    </html>
    I've replaced the manifest and clear key just for display purpose.

    Thanks in advance
    Quote Quote  
  2. Firefox can execute a source html using the protocol file://.
    All the other browsers needs an http server to run such html5 player.
    I wrote a local & portable DrmPlayer just using this approach. My script generates a local html Clappr template filling it from a channels list& keys, displayed by a simple menu', and then starts a Firefox new-tab.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!