プラグインレジストリとは何ですか?
プラグインレジストリは、Brightcove プラグインに関する情報を格納するためのプレーヤー管理 API のセクションです。レジストリは、保存された各プラグインのすべてのバージョン、およびそれぞれに関連付けられたスクリプトとスタイルシートの参照として機能します。プレーヤーの設定では、プラグインレジストリを利用し、現在のプラグインバージョンを表示し、プラグインのバージョンを指定することもできます。
利点
Brightcove Player ユーザ向けのプラグインレジストリの利点は 3 つあります。
- プレーヤーで使用されているプラグインのバージョンと、その特定のプラグインバージョンに関連付けられている特定の JavaScript および CSS ファイルを正確に確認できます。
 - プレーヤーのバージョンと互換性のある新しいバージョンがリリースされたときに、プラグインが自動的に更新されるように設定できます。
 - 何らかの理由でプレーヤーを特定のプレーヤーバージョンに維持することを選択した場合、プラグインはそのプレーヤーのロック時に同じ特定のバージョンに残ります。プラグインがプレーヤーのバージョンと互換性のないバージョンにアップグレードされる心配はありません。
 
現在適格なプラグイン
次の表は、プラグインレジストリで動作する Brightcove が提供するプラグインを示しています。プラグインレジストリ ID は、プレーヤー管理 API と組み合わせてプレーヤー設定で使用されます。このドキュメントでは、多数の例を紹介します。
| プラグイン名 | プラグインレジストリ ID | 
|---|---|
| アドビアナリティクスプレーヤー | @brightcove /videojs-bc-aa | 
| Chromecast レシーバー | @brightcove /videojs-chromecast-receiver | 
| カスタムエンドスクリーン | @brightcove /videojs-custom-endscreen | 
| DRM | @brightcove/videojs-drm | 
| グーグルアナリティクスプレーヤー | @brightcove /videojs-bc-ga | 
| IMA3広告 | @brightcove /videojs-ima3 | 
| オーバーレイ | @brightcove/videojs-overlay | 
| ピクチャー・イン・ピクチャー | @brightcove/videojs-pip | 
| プレイリストUI | @brightcove /videojs-bc-playlist-ui | 
| 品質選択メニュー | @brightcove /videojs-quality-menu | 
| 社会的 | @brightcove/videojs-social | 
| SSAI | @brightcove/videojs-ssai | 
| Tealium プレーヤープラグイン | @brightcove /videojs-bc-tealium | 
プラグインの使用を指定する
プラグインの使用を指定するには、プレーヤーの作成時に、目的のプラグインのレジストリ ID を指定します。バージョン番号を指定する必要があります。自動更新を行うメジャーバージョン (  2.x など)、または自動更新されないマイナーバージョン (  2.0.10 など) のいずれかを指定します。バージョンの設定の詳細については、このドキュメントの後半で説明します。もしあればoptions、プラグインを提供することもできます。
    curl \
      --header "Content-Type: application/json" \
      --user $EMAIL \
      --request POST \
      --data '{
        "name": "Plugin Registry Test Player",
        "configuration": {
          "video_cloud": {
            "video": "4093372393001"
          },
          "plugins": [
           {
              "registry_id": "@brightcove/videojs-custom-endscreen",
              "version": "2.x",
              "options": { "content": "<strong>Content</strong> for <em>custom</em> end screen" }
           }
          ]
        }
      }' \
      https://players.api.brightcove.com/v2/accounts/$ACCOUNT_ID/players
          
    
    作成されたプレーヤーに関する情報は、プレーヤー管理 API によって返されます。返された URL 値を使用し、 index.html を config.json に変更し、その URL を参照して公開プレーヤーの設定を確認できます。
    {
      "id": "rkGD9W22Ob",
      "url": "http://players.brightcove.net/1507807800001/rkGD9W22Ob_default/index.html",
      "embed_code": "<iframe src='//players.brightcove.net/1507807800001/rkGD9W22Ob_default/index.html' allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>",
      "embed_in_page": "http://players.brightcove.net/1507807800001/rkGD9W22Ob_default/in_page.embed",
      "preview_url": "http://preview-players.brightcove.net/v2/accounts/1507807800001/players/rkGD9W22Ob/preview/embeds/default/master/index.html",
      "preview_embed_code": "<iframe src='//preview-players.brightcove.net/v2/accounts/1507807800001/players/rkGD9W22Ob/preview/embeds/default/master/index.html' allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>"
    }
    
    公開されたプレーヤーの設定では、プラグインに関する情報が表示されます。プラグインの特定のバージョンと、JavaScript および CSS ファイルの対応する値が表示されます。
    {
      "account_id": "1507807800001",
      "compatibility": true,
      "embed_id": "default",
      "player": {
        "template": {
          "name": "single-video-template",
          "version": "6.7.0"
        }
      },
      "player_id": "SyITgzdjb",
      "player_name": "Plugin Registry Test Player",
      "plugins": [{
        "injected_version": "2.0.10",
        "name": "customEndscreen",
        "registry_id": "@brightcove/videojs-custom-endscreen",
        "version": "2.x"
      }],
      "scripts": [
        "//players.brightcove.net/videojs-custom-endscreen/2.0.10/videojs-custom-endscreen.min.js"
      ],
      "stylesheets": [
        "//players.brightcove.net/videojs-custom-endscreen/2.0.10/videojs-custom-endscreen.css"
      ],
      "updated_at": "2017-09-26T17:39:10.080Z",
      "video_cloud": {
        "policy_key": "BCpkADawqM3hOj9I_wRb6jx7SLoklIm8eiW-MH1C0CO5xnf8ndABL7WJQOVdWIusPlnfKUD5EZvjHyJOQGeCFndODaM7CRz4h4GxUTLN3OmO7dTcLnxS3cYrXOZx4eaqaSbVFDx1yFTvWX7m",
        "video": "4093372393001"
      }
    }
    
    
    特定のメジャーバージョンを指定してください
使用しているプレーヤーと互換性のある特定のメジャーバージョンのプラグインの最新バージョンを使用するようにプレーヤーを設定できます。これを行うと、プラグインのマイナーバージョンがリリースされると、プラグインは自動的に最新のマイナーバージョンに更新されます。
たとえば、プラグインのメジャーバージョン 2 用のカスタムエンドスクリーンプラグインの最新互換バージョンをプレーヤーに含めるには、以下を使用します。
    curl \
      --header "Content-Type: application/json" \
      --user $EMAIL \
      --request POST \
      --data '{
        "name": "Plugin Registry Test Player",
        "configuration": {
          "video_cloud": {
            "video": "4093372393001"
          },
          "plugins": [
            {
              "registry_id": "@brightcove/videojs-custom-endscreen",
              "version": "2.x"
            }
          ]
        }
      }' \
      https://players.api.brightcove.com/v2/accounts/$ACCOUNT_ID/players
    
    結果の設定は、次のようになります。
    "plugins": [{
      "injected_version": "2.0.10",
      "name": "customEndscreen",
      "registry_id": "@brightcove/videojs-custom-endscreen",
      "version": "2.x"
    }],
    "scripts": [
      "//players.brightcove.net/videojs-custom-endscreen/2.0.10/videojs-custom-endscreen.min.js"
    ],
    "stylesheets": [
      "//players.brightcove.net/videojs-custom-endscreen/2.0.10/videojs-custom-endscreen.css"
    ],
    特定のバージョンを指定してください
使用するプラグインの特定のバージョンを指定できます。これを行うと、いかなる状況下でもプラグインは自動的に更新されないため、必要に応じて手動で更新する必要があります。
プラグインのバージョンをロックするには、プレーヤーの作成時にバージョンを指定するだけです。
    curl \
      --header "Content-Type: application/json" \
      --user $EMAIL \
      --request POST \
      --data '{
        "name": "Plugin Registry Test Player",
        "configuration": {
          "video_cloud": {
            "video": "4093372393001"
          },
          "plugins": [
            {
              "registry_id": "@brightcove/videojs-overlay",
              "version": "1.0.2"
            }
          ]
        }
      }' \
      https://players.api.brightcove.com/v2/accounts/$ACCOUNT_ID/players
          
    
    プレーヤーの設定は、JavaScript ファイルと CSS ファイルだけでなく、特定のバージョンを反映します。
    "plugins": [{
      "name": "overlay",
      "registry_id": "@brightcove/videojs-overlay",
      "version": "1.0.2"
    }],
    "scripts": [
      "//players.brightcove.net/videojs-overlay/1.0.2/videojs-overlay.min.js"
    ],
    "stylesheets": [
      "//players.brightcove.net/videojs-overlay/1.0.2/videojs-overlay.css"
    ],
          
    互換性のない割り当て
互換性のないプラグインをプレーヤーに割り当てようとしたり、以前に割り当てられたプラグインとの互換性がなくなるようにプレーヤーのバージョンを変更したりすると、エラーが発生します。ここでエラーの詳細を示します。
互換性のないプレーヤーにプラグインを割り当てる
プレーヤーの作成または更新で、プレーヤーのバージョンと互換性のないプラグインバージョンを指定しようとすると、エラーが発生します。例えば、互換性がない、古いプラグインを新しいプレーヤーに割り当てようとするときの API からの応答を次に示します。
    {
      "message": "There are no versions of the plugin that match the specified major version. The major version specified was 1.x for plugin @brightcove/videojs-bc-playlist-ui",
      "error_code": "PLAYER_MANAGEMENT_ERROR",
    }
          
    
    プラグインと互換性がないようにプレーヤーのバージョンを変更する
既存のプレーヤーのバージョンを変更しようとすると、プレーヤーに新しく割り当てられたバージョンのプレーヤーと互換性のないプラグインがすでに存在する場合、次のようなエラーが表示されます。
    {
      "error_code":"APPLICATION_ERROR",
      "message":"plugin \"@brightcove/videojs-ima3\" is not compatible with template 5.28.1"
    }
    
    スタジオで設定されたプラグイン
プラグインが Studio 経由でロードされると、プラグインレジストリに新しい機能が反映されます。
    {
      "account_id": "1507807800001",
      "compatibility": true,
      "embed_id": "default",
      "player": {
        "template": {
          "name": "single-video-template",
          "version": "6.7.0"
        }
      },
      "player_id": "SJajDfuiW",
      "player_name": "Plugin Registry Studio Configuration",
      "plugins": [{
        "injected_version": "2.0.10",
        "name": "customEndscreen",
        "options": {
          "content": "<h3>This is the endscreen content</h3>"
        },
        "registry_id": "@brightcove/videojs-custom-endscreen",
        "version": "2.x"
      }],
      "scripts": [
        "//players.brightcove.net/videojs-custom-endscreen/2.0.10/videojs-custom-endscreen.min.js"
      ],
      "stylesheets": [
        "//players.brightcove.net/videojs-custom-endscreen/2.0.10/videojs-custom-endscreen.css"
      ],
      "updated_at": "2017-09-26T18:09:31.940Z",
      "video_cloud": {
        "policy_key": "BCpkADawqM3YPJvvfxBgJNEGrPjTPoOw0LyCbiTPnDGtAVExTzXeAW3hcRtPpS8tNeSiA9MosLG076eMXWO8E2Lxv-V7mq1oTIgqK7Xf0HBP_TEm1i-e5zRN_VIW_SjFagYpRxuoM8btiEoD",
        "video": null
      }
    }
          
    
    プレーヤーの設定でわかるように、Studioにロードされたプラグインはメジャーバージョンの動作を使用して更新されます。つまり、マイナーバージョンの更新が自動的に適用されます。
レジストリ情報の更新
標準の手順を使用して、プレーヤーのプラグインレジストリ情報を更新できます。たとえば、次の curl ステートメントは HTTP PATCH メソッドを使用して、プラグインを特定のバージョンからメジャーバージョン更新動作に変更します。
    curl \
      --header "Content-Type: application/json" \
      --user $EMAIL \
      --request PATCH \
      --data '{
        "plugins": [{
          "registry_id": "@brightcove/videojs-custom-endscreen",
          "version": "2.x"
        }]
      }' \
      https://players.api.brightcove.com/v2/accounts/$ACCOUNT_ID/players/$PLAYER_ID/configuration
          
    
    変更を行った後、プレーヤーを公開する必要があることを覚えておいてください。
プラグインレジストリ API
Player Management API に、レジストリからのプラグイン情報の取得を可能にする 2 つの新しいエンドポイントが追加されました。これにより、次の機能が提供されます。
- レジストリ内のすべてのプラグインを取得します。
 - 特定のプラグインに関する情報を取得します。
 
すべてのプラグインを取得
レジストリに現在含まれているプラグインに関する情報を取得するには、次のコマンドを使用します。
    curl \
      --header "Content-Type: application/json" \
      --user $EMAIL \
      --request GET \
      https://players.api.brightcove.com/v2/plugins
          
    
    
    
    返される情報は、次のようになります。
    [{
      "documentation": "https://support.brightcove.com/configuring-adobe-analytics-event-tracking",
      "description": "Adobe Analytics Player Plugin",
      "id": "@brightcove/videojs-bc-aa",
      "name": "bcAa",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/configuring-google-analytics-event-tracking",
      "description": "Google Analytics Player Plugin",
      "id": "@brightcove/videojs-bc-ga",
      "name": "bcGa",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/google-tag-manager-plugin-brightcove-player",
      "description": "Google Tag Manager Player Plugin",
      "id": "@brightcove/videojs-bc-gtm",
      "name": "bcGtm",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/playlist-ui-plugin",
      "description": "Brightcove customizations to videojs-playlist-ui",
      "id": "@brightcove/videojs-bc-playlist-ui",
      "name": "bcPlaylistUi",
      "current_version": "3.x"
    }, {
      "documentation": "https://support.brightcove.com/tealium-plugin-brightcove-player",
      "description": "Tealium Player Plugin",
      "id": "@brightcove/videojs-bc-tealium",
      "name": "bcTealium",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/beta-chromecast-plugin-brightcove-player",
      "description": "A Chromecast Receiver plugin for the Brightcove Player",
      "id": "@brightcove/videojs-chromecast-receiver",
      "name": "chromecastReceiver",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/custom-endscreen-plugin",
      "description": "Custom endscreens for video.js.",
      "id": "@brightcove/videojs-custom-endscreen",
      "name": "customEndscreen",
      "current_version": "2.x"
    }, {
      "documentation": "https://support.brightcove.com/configuring-brightcove-player-drm",
      "description": "Cross-browser support for MPEG-DASH w/ DRM using dash.js and silverlight and HLS Fairplay DRM",
      "id": "@brightcove/videojs-drm",
      "name": "eme",
      "current_version": "5.x"
    }, {
      "documentation": "https://support.brightcove.com/advertising-ima3-plugin",
      "description": "Google Interactive Media Ads (IMA) v3 support for video.js",
      "id": "@brightcove/videojs-ima3",
      "name": "ima3",
      "current_version": "3.x"
    }, {
      "documentation": "https://support.brightcove.com/display-overlay-plugin",
      "description": "Overlay for video.js.",
      "id": "@brightcove/videojs-overlay",
      "name": "overlay",
      "current_version": "2.x"
    }, {
      "documentation": "https://support.brightcove.com/picture-picture-plugin-aka-floating-or-pinned",
      "description": "A plugin for enabling a Picture-In-Picture mode for the Brightcove Player",
      "id": "@brightcove/videojs-pip",
      "name": "pip",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/manual-rendition-selection-plugin",
      "description": "Quality Selection Menu UI",
      "id": "@brightcove/videojs-quality-menu",
      "name": "qualityMenu",
      "current_version": "1.x"
    }, {
      "documentation": "https://support.brightcove.com/social-media-plugin",
      "description": "Social sharing integrations for video.js.",
      "id": "@brightcove/videojs-social",
      "name": "social",
      "current_version": "3.x"
    }, {
      "documentation": "https://support.brightcove.com/advertising-ssai-plugin",
      "description": "A plugin for the Brightcove Player implementing playback of SSAI streams.",
      "id": "@brightcove/videojs-ssai",
      "name": "ssai",
      "current_version": "1.x"
    }]
          
    
    特定のプラグイン情報を取得する
特定のプラグインに関する情報を取得するには、以下を使用します。プラグイン名は URL エンコードされなければならないので、@brightcove/videojs-ima3 使用する代わりに注意してください%40brightcove%2fvideojs-ima3 。
    curl \
      --header "Content-Type: application/json" \
      --user $EMAIL \
      --request GET \
      https://players.api.brightcove.com/v2/plugins/%40brightcove%2fvideojs-ima3
          
    
    返された情報は、次のようになります。
    {
      "versions": [{
        "scripts": ["//players.brightcove.net/videojs-ima3/3/videojs.ima3.min.js"],
        "stylesheets": ["//players.brightcove.net/videojs-ima3/3/videojs.ima3.min.css"],
        "version_number": "3.x",
        "minimum_template_version": "6.0.0"
      }, {
        "minimum_template_version": "5.0.0",
        "version_number": "2.x",
        "stylesheets": ["//players.brightcove.net/videojs-ima3/2/videojs.ima3.min.css"],
        "scripts": ["//players.brightcove.net/videojs-ima3/2/videojs.ima3.min.js"]
      }, {
        "minimum_template_version": "1.14.0",
        "version_number": "1.x",
        "stylesheets": ["//players.brightcove.net/videojs-ima3/1/videojs.ima3.min.css"],
        "scripts": ["//players.brightcove.net/videojs-ima3/1/videojs.ima3.min.js"]
      }],
      "documentation": "https://support.brightcove.com/advertising-ima3-plugin",
      "description": "Google Interactive Media Ads (IMA) v3 support for video.js",
      "id": "@brightcove/videojs-ima3",
      "name": "ima3",
      "current_version": "3.x"
    }
    
    この応答には表示されませんが、before_template-version プロパティと対応する値も表示されます。これは古いプラグインで表示され、そのプラグインバージョンと互換性のある最新のプレーヤーテンプレートバージョンを設定します。ザ・minimum_template_version そしてbefore_template-version プラグインと互換性のあるプレーヤーテンプレートバージョンの範囲を設定するために協力してください。