DRM 保護付きの HTML5 ビデオ プレーヤーを埋め込む方法

HaihaisoftのHTML5ビデオ向けDRM-X 4.0は、HTML5ビデオタグを使用しています。コンテンツプロバイダーは、標準のHTML5ビデオタグと、VideoJSなどの有名なHTML5プレーヤー、そしてJavaScriptを使用してHTML5プレーヤーと連携することで、簡単にビデオを埋め込むことができます。

その他のチュートリアル

DRM 保護付きの HTML5 ビデオ プレーヤーを埋め込む方法

プレーヤーを大幅に変更する必要がない場合は、以下のコードを使用してビデオを埋め込んでください。

<div id="Xvast_Video_URL" style="display: none;">https://www.drm-x.com/download/DRMX4/JesusFilm_cn_P.mp4</div>
<script type="text/javascript" src="https://www.xvast.com/dist/js/embedPlayer.js"></script>
<script type="text/javascript" src="https://www.xvast.com/dist/js/video.js"></script>
<script type="text/javascript" src="https://www.xvast.com/dist/wordpress/XvastVideoJSPlayer.js"></script>

プレーヤーを変更する必要がある場合は、次の紹介を参照してください。

ヘッドにVideoJSをインクルードします:

<!--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" />

ウェブサイトのスタイルに応じて他のスキンを使用することもできます。

ここでは、プレーヤーのスキンをカスタマイズできる VideoJS スキン生成ツールをお勧めします。 https://codepen.io/heff/pen/EarCt

VideoJSを埋め込む:

注記: iOS の場合は、id 値が xvast_ios_media_url の div を追加し、div を非表示にして、div にビデオの URL を記述します。Xvast はタグを自動的に認識し、ユーザーにこのビデオを再生するかどうかを尋ねます。例:

<div id="xvast_ios_media_url" style="display: none;">https://www.drm-x.com/download/drmx4/JesusFilm_cn_P.mp4</div>

iOS 向け Xvast の最新バージョンのメディア URL 注記:

iOSで動画を再生してもらうには、リンクに_Pを含む以下の文字を含める必要があります。例えば、リンクには_P.mp4、_P.mp3、または_P.pdf(大文字と小文字は区別されません)が含まれます。または、xvastが含まれます。ダウンロードリンクの任意の場所にこれらの文字のいずれかを含めることで、Xvast for iOSが認識し、ダウンロードをサポートします。

<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 Xvast, It Will remind the user to open the protected files in Xvast browser,
    // and remind the user to download Xvast browser.
    if(navigator.userAgent.indexOf("Xvast") == -1){
      document.write('Please open the protected files in Xvast browser. Download Xvast');
    }else{
      // Use HTML5 video tag;
      // Xvast will automatically change the video tag's ID,
      // here xvast_player will automatically become xvast_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="xvast_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/drmx4/JesusFilm_en_P.mp4" type="video/mp4"></video>);
    }
  </script>
</div>

Javascript コード:

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

      // Get HTML5 player
      // Xvast will automatically change xvast_player become xvast_player_html5_api;
      myVid=document.getElementById("xvast_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('xvast');
	// Check the mobile phone network type
      if(navigator.userAgent.indexOf("Mobile Xvast") > 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>

次の方法では、ライセンス情報 (オープンカウントと有効期限) を含む詳細情報を取得するためのリファレンスが提供されており、必要に応じてこの情報を取得できます。

function supportType(e,vidType,codType){
  myVid=document.getElementById("xvast_player_html5_api");
  isSupp=myVid.canPlayType("xvast");
  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;
    }
  }
}

その他のDRM-X 4.0チュートリアル

DRM-X 4.0 Introduction VideoDRM-X 4.0 紹介ビデオ

このビデオでは、DRM-X 4.0プラットフォームの使い方、暗号化前の設定方法、そしてビデオの暗号化方法をデモでご紹介します。暗号化されたビデオの再生方法もご紹介します。

今すぐ見る
DRM-X 4.0 Introduction VideoDRM-X 4.0 HTML ウェブページ暗号化チュートリアル

DRM-X 4.0は、HTML、CSS、JavaScript、画像を含むWebページを暗号化し、Webコンテンツを閲覧できるユーザーを制御します。コピーを阻止し、印刷やプリントスクリーンを防止し、閲覧できなくなったコンテンツを期限切れにします。

今すぐ見る
DRM-X 4.0 Introduction VideoXvast Windows ビデオチュートリアル

ビデオでは、Xvast ブラウザのダウンロード、インストール、使用方法、暗号化されたファイルを開く方法、使用時の問題を解決する方法のデモを紹介します。

今すぐ見る
DRM-X 4.0 Introduction VideoDRM-X 4.0 ビデオ暗号化チュートリアル

このビデオでは、DRM-X 4.0プラットフォームの使い方、暗号化前の設定方法、そしてビデオの暗号化方法をデモでご紹介します。暗号化されたビデオの再生方法もご紹介します。

今すぐ見る
DRM-X 4.0 Introduction VideoDRM-X 4.0とWordPressの統合

カスタムログインページの統合とは、お客様がウェブサイトから保護されたコンテンツを注文し、コンテンツを再生する際に、ウェブサイトのカスタマイズされたログインページが表示されることです。お客様がウェブサイトのアカウントのユーザー名とパスワードを入力すると、保護されたファイルを再生するためのライセンスが即座に取得されます。このためには、新しいDRMログインページを作成する必要があります。

今すぐ見る
DRM-X 4.0 Introduction VideoDRM-X 4.0 セキュリティ設定

DRM-X 4.0プラットフォームをご利用になる際は、ご注意ください。保護をより安全にするために、著作権侵害を防止するために必要な一連のオプションを選択してください。これらの設定は、最初に行うことが非常に重要です。

今すぐ見る

ご質問はありますか?

弊社の担当者がお答えします。

Haihaisoft 製品、価格、実装などについてお問い合わせください。高度な訓練を受けた当社の担当者が待機しており、いつでもお手伝いいたします。

電話: +64 27 507 9959 (ニュージーランド)

QQ: 1279126286 / 994184623

お問い合わせマイクロソフトチーム

service#haihaisoft.com (#を@に置き換えてください)

お問い合わせ
contactUs