Como incorporar um reprodutor de vídeo HTML5 com proteção DRM?

O DRM-X 5.0 da Haihaisoft para vídeo HTML5 utiliza a tag HTML5 Video. Os provedores de conteúdo podem incorporar vídeos facilmente usando a tag HTML5 Video padrão e players HTML5 populares, como o VideoJS, além de interagir com eles por meio de JavaScript.

Mais tutoriais
Como incorporar um reprodutor de vídeo HTML5 com proteção DRM?

Como incorporar um reprodutor de vídeo HTML5 com proteção DRM?

Se não for necessário modificar profundamente o reprodutor, utilize o código abaixo para incorporar o vídeo.

<div id="ZJGet_Video_URL" style="display: none;">https://www.drm-x.com/download/drmx5/HolyForever-ChrisTomlin_P.mp4</div>
<script type="text/javascript" src="https://www.zjget.com/assets/embed_js/embed_zjget.js"></script>
<script type="text/javascript" src="https://www.zjget.com/assets/videojs-8.23.3/video.min.js"></script>
<script type="text/javascript" src="https://www.zjget.com/assets/embed_js/zjget.js"></script>

Caso precise modificar o reprodutor, consulte a introdução a seguir.

Inclua o VideoJS no cabeçalho:

<!--Include VideoJS library-->
<link rel="stylesheet" type="text/css" href="css/video-js.css" />
<script src="js/video.js" type="text/javascript" charset="utf-8"></script>

<!--Using VideoJS skin-->
<link rel="stylesheet" type="text/css" href="css/skin/TechSkin-skin.css" />

Você também pode usar o outro tema de acordo com o estilo do seu site.

Aqui recomendamos uma ferramenta de geração de skins para VideoJS, que permite personalizar a aparência do player. https://codepen.io/heff/pen/EarCt

Incorporar VideoJS:

Observação: Para iOS, adicione uma div com o valor de id zjget_ios_media_url, oculte a div, escreva a URL do vídeo dentro dela e o ZJGet reconhecerá automaticamente a tag, perguntando ao usuário se deseja reproduzir o vídeo. Por exemplo:

<div id="zjget_ios_media_url" style="display: none;">https://www.drm-x.com/download/drmx5/HolyForever-ChrisTomlin_P.mp4</div>

A versão mais recente do ZJGet para iOS contém as seguintes observações sobre URLs de mídia:

Se você deseja que seus clientes reproduzam seus vídeos no iOS, o link deve conter as seguintes características, com o prefixo _P. Por exemplo, o link pode conter _P.mp4, _P.webm ou _P.mp3 (sem distinção entre maiúsculas e minúsculas). Ou então, deve conter &quot;zjget&quot;. Você pode incluir uma dessas características em qualquer lugar do link de download, e o ZJGet para iOS reconhecerá e dará suporte aos downloads.

<div id="LoadingText" style="display: none;" align="center">
  Please wait, connecting to obtain license page...
</div>
<div id="cellular_button" align="center"></div>
<div align="center">
  <script type="text/javascript">
    // Detecting current browser, if not ZJGet, It Will remind the user to open the protected files in ZJGet browser,
    // and remind the user to download ZJGet browser.
    if(navigator.userAgent.indexOf("ZJGet") == -1){
      document.write('Please open the protected files in ZJGet browser. Download ZJGet');
    }else{
      // Use HTML5 video tag;
      // ZJGet will automatically change the video tag's ID,
      // here zjget_player will automatically become zjget_player_html5_api;
      // Use src attribute specifies video URL;
      // class="video-js" using VideoJS style.
      // In data-setup, use "autoplay":true; add auto play control;
      // In data-setup, you can use "playbackRates": [0.5, 0.7, 1, 1.5, 2, 3, 4] add control speed function.;
      document.write('<'video id="zjget_player" controls="controls" class="video-js" data-setup=\' {"playbackRates": [0.5, 0.7, 1, 1.2, 1.5, 2], "autoplay":false, "width": 856, "height": 480 }\'><'source src="https://www.drm-x.com/download/drmx5/HolyForever-ChrisTomlin_P.mp4" type="video/mp4"></video>);
    }
  </script>
</div>

Código Javascript:

<script type="text/javascript">
  document.onreadystatechange = function() {
    if (document.readyState == "complete") { // After the page is complete, and execute,Required;

      // Get HTML5 player
      // ZJGet will automatically change zjget_player become zjget_player_html5_api;
      myVid=document.getElementById("zjget_player_html5_api");

      // Get detail information return by the player, 

      // if user need to obtain a license, It will return a URL;

      // Otherwise, It will return the details of the protected file information and the license information.
      isSupp=myVid.canPlayType('zjget');
	// Check the mobile phone network type
      if(navigator.userAgent.indexOf("Mobile ZJGet") > 0){
		var con = window.navigator.connection;
		var network = con.type; // Mobile phone network:cellular; wifi:wifi
		// Check whether your phone is using a mobile network or wifi
		if (network == "cellular"){ // If the phone is using a mobile network, you need to add a button to get a license to the page
			document.getElementById("cellular_button").innerHTML = '<'button style="height: 50px" class="m_g_b" onClick="supportType(event,\'video/ogg\',\'theora, vorbis\')">Play Protected file (Click 2 times)'<'/button>;
		}
	  }
      // If the information contained in the return message contains URL,

      // it is required to obtain a license.
      if(isSupp.indexOf("http")>0){
        // Just a tips, non - must;
        document.getElementById("LoadingText").style.display='block';
        // Using substring to capture a URL to obtain license;
        licURL = isSupp.substring(isSupp.indexOf("http"));
        // Redirecting to obtain license page to verify and obtain license.
        window.location.href = licURL;
      }
    }
};
</script>

O método a seguir fornece uma referência para obter mais informações, incluindo informações sobre a licença (número de aberturas e data de expiração). Você pode obter essas informações de acordo com suas necessidades.

function supportType(e,vidType,codType){
  myVid=document.getElementById("zjget_player_html5_api");
  isSupp=myVid.canPlayType("zjget");
  myVid.play();
  licURL = isSupp.substring(isSupp.indexOf("http"));

  if(isSupp.indexOf("http")>0){
    window.location.href = licURL;
  }else{
    if(isSupp.indexOf("License")>0){

      // Get open count
      var openCount=isSupp.substring(isSupp.indexOf(":"),isSupp.indexOf(";"));

      // Get the license expiration date
      var ft=isSupp.substring(isSupp.indexOf(";")+1);
      var ut = filetime_to_unixtime(ft);
      var d = new Date(ut * 1000);
      e.target.parentNode.innerHTML ="Open Count" + openCount + ", Expiration date:" + d.toLocaleString();
      return;
    }

    if(isSupp.indexOf("Error ID = 3")>0){
      e.target.parentNode.innerHTML ="License is expired, Please Re open the protected file to obtain a new license.";
      return;
    }
  }
}

Outros Tutoriais DRM-X 5.0

DRM-X 5.0 ZJGet Windows Video TutorialTutorial de Criptografia Windows ZJGet DRM-X 5.0

Este vídeo demonstra como criptografar arquivos no Windows usando o navegador ZJGet.

ASSISTIR AGORA
DRM-X 5.0 ZJGet macOS Video TutorialTutorial de Criptografia MacOS ZJGet DRM-X 5.0

Este vídeo demonstra como criptografar arquivos no macOS usando o navegador ZJGet.

ASSISTIR AGORA
DRM-X 5.0 ZJGet Windows TutorialTutorial do DRM-X 5.0 ZJGet para Windows

Este vídeo mostrará como baixar, instalar e abrir arquivos criptografados no Windows usando o navegador ZJGet.

ASSISTIR AGORA
DRM-X 5.0 ZJGet Text TutorialTutorial em Texto do DRM-X 5.0 ZJGet

Guia do usuário do navegador ZJGet. Este tutorial ajudará você a dominar facilmente os recursos principais e as dicas práticas do navegador ZJGet.

ASSISTIR AGORA
DRM-X 5.0 ZJGet Graphic Tutorial AnswersPerguntas Frequentes (FAQ) do DRM-X 5.0 ZJGet

Perguntas frequentes (FAQ) sobre o uso do navegador ZJGet. Esta seção compila as perguntas e respostas mais úteis para ajudá-lo a superar quaisquer obstáculos que possa encontrar.

ASSISTIR AGORA
DRM-X 5.0 自动批量加密工具完整操作指南Guia completo de operação da ferramenta de criptografia automática em lote DRM-X 5.0

The DRM-X 5.0 Automated Batch Encryption Tool offers both manual and automatic scanning modes, supports multiple file formats, and enables PDF-to-HTML encryption, helping businesses efficiently and automatically implement digital rights management for batch files.

ASSISTIR AGORA

Questões?

Nossos representantes têm as respostas.

Pergunte sobre os produtos, preços, implementação ou qualquer outro assunto relacionado à Haihaisoft — nossos representantes altamente treinados estão à disposição para ajudar.

Telefone: +64 27 507 9959 (Nova Zelândia)

QQ: 1279126286 / 994184623

Entre em contato conosco em Microsoft Teams

serviço#haihaisoft.com (substitua # por @)

Contato
contactUs