TVE で Brightcove Player を使用する
アカウント設定
Video Cloud を TVE と組み合わせて使用するには、Brightcove サポートによるアカウント設定が必要です。TVE を利用したい場合は、Brightcove サポートにお問い合わせください。
必須フィールド
この連携を行う際、アカウント内に以下のカスタムフィールドを 1 つ以上作成することを推奨します。以下に示す名前はフィールドの 内部 名であり、表示名としては任意の名称を使用できます。
bcadobepassrequestoridbcadobepasstitlebcadobepassreferenceidbcadobepassratingbcadobepassratingscheme
次のセクションでは、これらのフィールドが存在する場合にどのように使用されるか、存在しない場合にはどの値が代わりに使用されるかについて説明します。
resourceID および requestorID フィールドの自動生成
TVE が有効なアカウントで Playback API を使用して動画を取得した場合、API は以下のルールに従って bcadobepassrequestorid の値を返します:
- 動画に
bcadobepassrequestoridのカスタムフィールド値が存在する場合:動画レベルの値が返されます。 bcadobepassrequestoridに値が設定されていない場合:アカウント設定に保存されている requestor ID が返されます。
同様に、API は以下のルールに従って bcadobepassresourceid の値を返します:
bcadobepassresourceidのカスタムフィールド値が存在する場合:指定されたフィールド値が返されます。- 値が設定されていない場合:以下に示すフィールド値および XML 形式に基づいた自動生成値が返されます。
生成される bcadobepassresourceid は、Adobe が指定し Comcast との統合で広く使用されている MRSS 形式に準拠している必要があります。
<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'>
<channel>
<title>channel</title>
<item><title>item-title</title>
<guid>guid</guid>
<media:rating scheme='urn:rating-scheme'>rating</media:rating></item>
</channel>
</rss>
MRSS に含まれる値は、以下のルールに基づいて決定されます。
| RSS XML フィールド | Video Cloud フィールド |
|---|---|
channel |
|
item-title |
|
guid |
|
rating |
|
rating-scheme |
|
プレーヤーの設定
以下のコードは、TVE 用に Brightcove プレーヤーを設定するためのモデルとなるものです。
<!doctype html>
<html>
<head>
<title>TVE Example</title>
</head>
<body>
<!-- Make sure your player doesn't have a video associated with it
and don't use data-video-id to assign one. We'll request a video
from the catalog by hand, detect that it's TVE content, trigger TVE
authentication and then load the video into the player. -->
<video-js id="tve-player"
data-account="account1234"
data-player="player-id"
controls>
</video-js>
<script src="//players.brightcove.net/account1234/player-id_default/index.min.js"></script>
<script>
var player = videojs.getPlayer('tve-player');
player.ready(function() {
player.catalog.getVideo('ref:tve-video', function(error, video) {
if (error) {
// showErrorMessage() would be defined by you somewhere else
// in the page
return showErrorMessage(error);
}
// You can tell whether a video is TVE protected by checking to
// see if the video sources contain URLs. If they don't, you need
// to authenticate your viewer and re-request the video with their
// TVE credentials.
if (video.sources && video.sources[0].src) {
// This is not a TVE video so it can be played back immediately
return player.catalog.load(video);
}
// From here on, we're definitely dealing with a TVE video.
// You need to provide an implementation for authenticateWithTVE()
// to get a TVE token. See the documentation from your TVE provider
// for details on how to do that.
autenticateWithTVE(function(error, tveToken) {
if (error) {
return showErorMessage(error);
}
// Now that we have the token, we can re-request the video and get playable URLs.
player.catalog.tveToken = tveToken;
player.catalog.getVideo('ref:tve-video', function(error, video) {
if (error) {
return showErrorMessage(error);
}
player.catalog.load(video);
});
});
});
});
</script>
</body>
</html>
認証なしリクエストに対するレスポンス
以下は、TVE 認証が提供されていない場合の Playback API からのレスポンス例です。ご覧のとおり、動画ソースは利用できませんが、プレーヤーがコンテンツのプレビューを表示できるよう、その他の動画メタデータは取得できます。
{
"sources": [
],
"description": "The short description can be used to give more information about your video and will appear in many standard Brightcove Player templates.",
"poster_sources": [
{
"src": "http://f1.media.brightcove.com/8/96980657001/96980657001_207574837001_commonRedpoll-still.jpg?pubId=3840518800001&videoId=3843070012001"
},
{
"src": "https://f1.media.brightcove.com/8/96980657001/96980657001_207574837001_commonRedpoll-still.jpg?pubId=3840518800001&videoId=3843070012001"
}
],
"tags": [
"sample"
],
"cue_points": [
],
"errors": [
{
"error_subcode": "TVE_AUTH",
"error_code": "SOURCES_RESTRICTED",
"message": "Video sources are restricted by access policy.",
"restricted_fields": [
"sources"
]
}
],
"custom_fields": {
"bcadobepassresourceid": "
-
anotherRefId
XXX
",
"bcadobepassrequestorid": "asdfasf",
"bcadobepassrating": "XXX",
"bcadobepassreferenceid": "anotherRefId",
"bcadobepasstitle": "PassTitle",
"bcadobepassratingscheme": "TV-14"
},
"account_id": "3840518800001",
"name": "Sample Video 2",
"reference_id": null,
"long_description": null,
"duration": 29960,
"economics": "AD_SUPPORTED",
"published_at": "2014-10-16T16:35:24.520Z",
"text_tracks": [
],
"updated_at": "2017-05-26T01:48:41.396Z",
"thumbnail": "http://f1.media.brightcove.com/8/96980657001/96980657001_180424037001_commonRedpoll-thumbnail.jpg?pubId=3840518800001&videoId=3843070012001",
"poster": "http://f1.media.brightcove.com/8/96980657001/96980657001_207574837001_commonRedpoll-still.jpg?pubId=3840518800001&videoId=3843070012001",
"offline_enabled": false,
"link": null,
"id": "3843070012001",
"ad_keys": null,
"thumbnail_sources": [
{
"src": "http://f1.media.brightcove.com/8/96980657001/96980657001_180424037001_commonRedpoll-thumbnail.jpg?pubId=3840518800001&videoId=3843070012001"
},
{
"src": "https://f1.media.brightcove.com/8/96980657001/96980657001_180424037001_commonRedpoll-thumbnail.jpg?pubId=3840518800001&videoId=3843070012001"
}
],
"created_at": "2014-10-16T16:35:24.520Z"
}