Legacy Knowledge Base
公開されました Jul. 2, 2025

DXP 7.1のウェブコンテンツ記事に動画を埋め込む

Written By

Justin Choi

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

この参考記事では、Liferay Digital Experience Platform 7.1のWebコンテンツ記事に動画を埋め込む方法について説明します。 これは、 Webコンテンツの公開 や 構造とテンプレートを使用したコンテンツの最適化に関するLiferayの公式ドキュメントを補足するために設計されています。 まずはそれらの記事を読んで、基本的なことを学んだ方がいいかもしれません。

ビデオを埋め込む方法

  1. 使用例1:Youtube動画の埋め込み
  2. 使用例2: ドキュメントやメディアに保存された動画を埋め込む
  3. ユースケースその3:カスタムWebコンテンツの構造とテンプレート
  4. 参考文献

決議

Youtube動画の埋め込み

Youtubeなどのストリーム動画をWebコンテンツの記事に埋め込むのはとても簡単です。 (注: 以下の説明では、AlloyEditor を選択したテキストエディタを想定しています)

  1. 先に進む前に、URLだけでなく、Youtube(または他のストリーミングサービス)から特定の埋め込みコードをコピーするようにしてください。 普通はこんな感じです。
    <iframe width="560" height="315" src="https://www.youtube.com/embed/jzF_y039slk" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen> </iframe >
    	
  2. 左側のメニューで、 コンテンツ ( DXP 7.2ではコンテンツ & データ )をクリックします。
  3. Webコンテンツをクリックします。をクリックします。
  4. プラス記号 →基本的なWebコンテンツをクリックします。
  5. タイトル 欄にタイトルを入力します(例:The Piano Guys - Over the Rainbow)。
  6. 右端の コードビュー アイコンをクリックします。
  7. テキストフィールドに埋め込みコードを貼り付けます。
  8. をクリックして、を発行します。

次に、新しく作成したWebコンテンツ記事をページに配置します。 記事が表示されるサイトページに移動します。

  1. 追加 ボタンをクリックします。
  2. ページに のWebコンテンツ表示 ポートレットを追加します。
  3. Webコンテンツの選択をクリックして、 リンクを表示させます。
  4. をクリックして、 を選択し、記事を選択します。
  5. 記事名をクリックしてください(例:Piano Guys - Over the Rainbow)。
  6. をクリックして を保存し、設定ウィンドウを閉じます。

埋め込み動画のページになりました。
埋め込み動画-71-01.png

それはVimeoなどの他のストリーミングビデオプラットフォームでは異なりますが、基本的な原則は同じです。 Vimeoの場合は、このような埋め込みコードを取得します。

<iframe src="https://player.vimeo.com/video/266878736" width="640" height="270" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/266878736">PROTEUS</a> from <a href="https://vimeo.com/user84342633">Floating House VFX</a> on <a href="https://vimeo.com">Vimeo</a>.</p>

それをコピーしてテキストエディタのフィールドに貼り付けます。 この時点で、Vimeoの動画はWebコンテンツの記事に埋め込まれます。

ドキュメントやメディアに保存された動画を埋め込む

動画が [ドキュメントとメディア] ポートレットに保存されている場合、基本的な Web コンテンツ構造を使用したまま、Web コンテンツ記事に動画を埋め込むことができます。 このメソッドは、 ブラウザがHTML5動画 形式をサポートしていることを前提としています。

はじめに、埋め込みたい動画のURLを探します。

  1. コンテンツ ( DXP 7.2 のコンテンツ & データ )→ ドキュメントとメディアに移動します。
  2. 動画のタイトルをクリックしてください。
  3. 右上の 情報 アイコンをクリックします。 これは、 の詳細 タブを展開します。
  4. をクリックしてURLを取得.
    埋め込み動画-71-02.png
  5. URLをコピーします。 こんな感じです。
    http://localhost:8080/documents/34548/0/2016-09-30+09.10.30.mp4/ca4e8789-fada-c6a1-aae0-c609d2664715
  6. 次に、Webコンテンツ記事を作成します。
  7. 左側の コンテンツ メニューの ウェブコンテンツ をクリックします(DXP 7.2ではコンテンツ & データ )。
  8. プラス記号 →基本的なWebコンテンツをクリックします。
  9. 記事のタイトルを入力します。
  10. 右端の コードビュー アイコンをクリックします。
  11. 次のコードスニペットを動画の URL に貼り付けます。
    <!DOCTYPE html>
    <html>
    <body>
    
    <video width="320" height="240" autoplay>
      <source src="http://localhost:8080/documents/34548/0/2016-09-30+09.10.30.mp4/ca4e8789-fada-c6a1-aae0-c609d2664715" type="video/mp4">
      Your browser does not support the video tag.
    </video>
    
    <p><b>Note:</b> The autoplay attribute does not work on some mobile devices.</p>
    
    </body>
    </html>
    
  12. をクリックして、を発行します。

上記と同じ手順で、Webコンテンツの記事をページに表示します。
embedding-videos03.png
より高度な機能には、再生/一時停止や動画のサイズ変更など、より多くの機能のためにJavascriptを追加することを検討してください。

カスタムWebコンテンツの構造とテンプレート

先ほどの例では、ブラウザがHTML5 Videoに対応しているかどうかが制限になっています。 複数の記事に対して拡張性を持たせるために、構造体とそれに対応するテンプレートを作成します。 Liferay独自のWebデザインチームをベースにした例を提供しており、各ユーザーのニーズに応じて修正する必要があります。

この概念実証はLiferay Portal 6.2をベースにしているため、Liferay Digital Experience Platform 7.x用にアップデートする必要があります。

Did this article resolve your issue ?

Legacy Knowledge Base