📘 公式リファレンス📦 リファレンス/オブジェクト中級
video_source オブジェクト
動画メディアのソースファイルに関する情報を保持するオブジェクト。ファイル形式、寸法、MIME タイプ、CDN URL などを提供する。
用途
商品ページの動画メディアで複数の形式(mp4、m3u8、mov)を出し分けたり、動画プレイヤーに最適なソースを選択したいとき。
設置場所
Liquid テンプレート内で `{{ product.media[i].sources[j].format }}` のように `video_source` オブジェクトのプロパティを参照する。動画プレイヤーの `<source>` タグの `src`、`type` 属性に値を入れるときに使う。
注意点
mp4 動画をアップロードすると Shopify が自動的に m3u8 ファイルを追加生成するため、ブラウザの接続速度に応じた HTTP ライブストリーミング(HLS)配信が可能になる。ただし m3u8 は Safari など限定ブラウザでの再生が前提のため、クロスブラウザ対応が必要なときは mp4 と m3u8 の両方を `<source>` タグで列挙して、ブラウザの対応形式を自動選択させるとよい。
仕様
118 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "video",
"property": "sources"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The width of the video source file.",
"name": "width"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> When mp4 videos are uploaded, Shopify generates an m3u8 file as an additional video source. An m3u8 file enables video\n> players to leverage HTTP live streaming (HLS), resulting in an optimized video experience based on the user's internet\n> connection.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "mov",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "mp4",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "m3u8",
"description": "",
"array_value": ""
}
],
"summary": "The format of the video source file.",
"name": "format"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The height of the video source file.",
"name": "height"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the video source file.",
"name": "mime_type"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) of the video source file.",
"name": "url"
}
],
"summary": "Information about the source files for a video.",
"name": "video_source",
"examples": [],
"json_data": {
"path": "/products/potion-beats",
"handle": "product.media[1].sources[1]",
"data_from_file": ""
},
"return_type": []
}出典・ライセンス
- Repository:
- https://github.com/Shopify/theme-liquid-docs
- License:
- MIT
このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。
関連項目
📘 公式リファレンス📦 リファレンス/オブジェクト初級
content_for_header オブジェクト
Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。
📁 theme-liquid-docs·MIT·20 行
📘 公式リファレンス📦 リファレンス/オブジェクト中級
metaobjects オブジェクト
ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。
📁 theme-liquid-docs·MIT·20 行
📘 公式リファレンス📦 リファレンス/オブジェクト初級
additional_checkout_buttons オブジェクト
PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。
📁 theme-liquid-docs·MIT·27 行
📘 公式リファレンス📦 リファレンス/オブジェクト初級
canonical_url オブジェクト
現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。
📁 theme-liquid-docs·MIT·27 行
📘 公式リファレンス📦 リファレンス/オブジェクト初級
content_for_index オブジェクト
ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。
📁 theme-liquid-docs·MIT·27 行
📘 公式リファレンス📦 リファレンス/オブジェクト初級
content_for_additional_checkout_buttons オブジェクト
PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。
📁 theme-liquid-docs·MIT·27 行