|
|
@@ -1,8 +1,16 @@
|
|
|
+# ビデオのセットアップ
|
|
|
+<!--
|
|
|
# Set up a video
|
|
|
+-->
|
|
|
|
|
|
+<span class="label label-doc-level">初級</span>
|
|
|
+<span class="label label-doc-audience">プログラマー</span>
|
|
|
+<span class="label label-doc-audience">デザイナー</span>
|
|
|
+<!--
|
|
|
<span class="label label-doc-level">Beginner</span>
|
|
|
<span class="label label-doc-audience">Programmer</span>
|
|
|
<span class="label label-doc-audience">Designer</span>
|
|
|
+-->
|
|
|
|
|
|
<p>
|
|
|
<video autoplay loop class="responsive-video" poster="media/video-thumbnail.jpg">
|
|
|
@@ -10,16 +18,54 @@
|
|
|
</video>
|
|
|
</p>
|
|
|
|
|
|
+>[!Note]
|
|
|
+>Stride はほとんどの主要なビデオフォーマットをサポートしていますが、それらは `.mp4` に変換されます。コンパイル時間を短縮するために、最初から `.mp4` ファイルを使用することをお勧めします。そうすれば、Stride がそれらを変換する必要がなくなります。
|
|
|
+
|
|
|
+<!--
|
|
|
>[!Note]
|
|
|
>Stride supports most major video formats, but converts them to `.mp4`. To reduce compilation time, we recommend you use `.mp4` files so Stride doesn't have to convert them.
|
|
|
+-->
|
|
|
+
|
|
|
+>[!Note]
|
|
|
+>今のところ、Stride は iOS プラットフォームではビデオをサポートしていません。
|
|
|
|
|
|
+<!--
|
|
|
>[!Note]
|
|
|
>Currently, Stride doesn't support video on iOS platforms.
|
|
|
+-->
|
|
|
|
|
|
+## 1. ビデオアセットを追加する
|
|
|
+<!--
|
|
|
## 1. Add a video asset
|
|
|
+-->
|
|
|
|
|
|
+ゲームでビデオを使う前に、[アセット](../game-studio/assets.md)としてインポートする必要があります。
|
|
|
+<!--
|
|
|
Before you can use a video in your game, you need to import it as an [asset](../game-studio/assets.md).
|
|
|
+-->
|
|
|
+
|
|
|
+1. ビデオファイルを、**エクスプローラー**から**アセットビュー**にドラッグします。
|
|
|
+
|
|
|
+ または、**アセットビュー**で [**Add asset**] をクリックし、[**Media**] > [**Video**] を選択し、追加したいビデオを選択して [**Open**] をクリックします。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+2. ビデオがオーディオトラックを持っている場合は、ビデオとオーディオを同時にインポートするか、あるいはビデオからオーディオをインポートすることができます。
|
|
|
+
|
|
|
+ 
|
|
|
|
|
|
+3. [**OK**] をクリックします。
|
|
|
+
|
|
|
+ Stride は、ビデオをアセットとして**アセットビュー**に追加します。ビデオファイルからオーディオトラックをインポートした場合は、Stride はそれらを独立した[オーディオ](../audio/index.md)アセットとして追加します。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+ >[!Note]
|
|
|
+ >今のところ、アセットプレビューでビデオをプレビューすることはできません。
|
|
|
+
|
|
|
+ ビデオアセットのプロパティの詳細については、[ビデオのプロパティ](video-properties.md)を参照してください。
|
|
|
+
|
|
|
+<!--
|
|
|
1. Drag the video file from **Explorer** into the **Asset View**.
|
|
|
|
|
|
Alternatively, in the **Asset View**, click **Add asset** and select **Media > Video**, then browse to the video you want to add and click **Open**.
|
|
|
@@ -40,9 +86,39 @@ Before you can use a video in your game, you need to import it as an [asset](../
|
|
|
>Currently, you can't preview videos in the Asset Preview.
|
|
|
|
|
|
For information about video asset properties, see [Video properties](video-properties.md).
|
|
|
+-->
|
|
|
|
|
|
+## 2. ビデオコンポーネントを追加する
|
|
|
+<!--
|
|
|
## 2. Add a video component
|
|
|
+-->
|
|
|
+
|
|
|
+1. **シーンエディター**で、ビデオコンポーネントを追加する先となるエンティティを選択または作成します。
|
|
|
+
|
|
|
+ >[!Tip]
|
|
|
+ >通常は、ビデオを再生するためのテクスチャーを持つエンティティにビデオコンポーネントを追加するのが最も簡単です。そうすることで、シーンが整理しやすくなります。
|
|
|
+
|
|
|
+2. **プロパティグリッド**で、[**Add component**] をクリックし、[**Video**] > [**Video**] を選択します。
|
|
|
|
|
|
+ 
|
|
|
+
|
|
|
+ Stride は、エンティティに**ビデオコンポーネント**を追加します。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+3. **Video** プロパティの **Source** で、ビデオアセットを選択します。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+4. **Target** プロパティで、ビデオの表示に使用するテクスチャを選択します。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+ モデルは、このテクスチャーをビデオの表示に使います。
|
|
|
+
|
|
|
+ ビデオが再生されていないときには、Stride はそのテクスチャを代わりに表示します。
|
|
|
+
|
|
|
+<!--
|
|
|
1. In the **Scene Editor**, select or create an entity to add a video component to.
|
|
|
|
|
|
>[!Tip]
|
|
|
@@ -67,17 +143,36 @@ Before you can use a video in your game, you need to import it as an [asset](../
|
|
|
Models that use this texture will display the video.
|
|
|
|
|
|
When the video isn't playing in your scene, Stride displays the texture instead.
|
|
|
+-->
|
|
|
|
|
|
+## 3. ビデオを再生するスクリプトを作成する
|
|
|
+<!--
|
|
|
## 3. Create a script to play the video
|
|
|
+-->
|
|
|
|
|
|
-After you set up the video component, play it from a [script](../scripts/index.md) using:
|
|
|
+ビデオコンポーネントをセットアップした後に、[スクリプト](../scripts/index.md)で以下のように再生します。
|
|
|
|
|
|
```cs
|
|
|
myVideoComponent.Instance.Play();
|
|
|
```
|
|
|
|
|
|
+### その他の関数
|
|
|
+<!--
|
|
|
### Other functions
|
|
|
-
|
|
|
+-->
|
|
|
+
|
|
|
+* `LoopRange`: ループ範囲(`PlayRange` で指定した範囲内である必要があります)。
|
|
|
+* `IsLooping`: ビデオを無限にループします。
|
|
|
+* `SpeedFactor`: 再生速度。通常の速度は `1` です。
|
|
|
+* `PlayState`: 現在のビデオ再生状態(`playing`, `paused`, `stopped` のいずれか)。
|
|
|
+* `Duration`: ビデオの長さ。
|
|
|
+* `CurrentTime`: 現在の再生時刻(ビデオの先頭から)。
|
|
|
+* `Volume`: オーディオの音量。
|
|
|
+* `PlayRange`: ビデオの開始時刻と終了時刻。
|
|
|
+* `Play/Pause/Stop`: ビデオを再生、一時停止、停止します。
|
|
|
+* `Seek`: 指定時刻に移動します。
|
|
|
+
|
|
|
+<!--
|
|
|
* `LoopRange`: The looping range (must be an area in the video in `PlayRange`)
|
|
|
* `IsLooping`: Loop the video loop infinitely
|
|
|
* `SpeedFactor`: Set the video play speed. `1` is normal speed.
|
|
|
@@ -88,17 +183,23 @@ myVideoComponent.Instance.Play();
|
|
|
* `PlayRange`: The video start and end time
|
|
|
* `Play/Pause/Stop`: Play, pause, or stop the video
|
|
|
* `Seek`: Seek to a given time
|
|
|
+-->
|
|
|
|
|
|
+### サンプルスクリプト
|
|
|
+<!--
|
|
|
### Example script
|
|
|
+-->
|
|
|
|
|
|
```cs
|
|
|
{
|
|
|
public class VideoScript : StartupScript
|
|
|
{
|
|
|
+ // Game Studioは、このスクリプトで宣言したパブリックメンバーフィールドとプロパティを表示します。
|
|
|
// Game Studio displays the public member fields and properties you declare in this script
|
|
|
|
|
|
public override void Start()
|
|
|
{
|
|
|
+ // スクリプトの初期化。
|
|
|
// Initialization of the script.
|
|
|
Entity.Get<VideoComponent>().Instance.Play();
|
|
|
}
|
|
|
@@ -106,8 +207,24 @@ myVideoComponent.Instance.Play();
|
|
|
}
|
|
|
```
|
|
|
|
|
|
+## 4. エンティティにスクリプトを追加する
|
|
|
+<!--
|
|
|
## 4. Add the script to the entity
|
|
|
+-->
|
|
|
|
|
|
+1. **シーンエディター**で、ビデオコンポーネントを持つエンティティを選択します。
|
|
|
+
|
|
|
+2. **プロパティグリッド**で、[**Add component**] をクリックし、ビデオスクリプトを選択します。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+ Stride は、そのスクリプトをコンポーネントとして追加します。
|
|
|
+
|
|
|
+ **プロパティグリッド**で、コンポーネントのプロパティで[スクリプトで定義したpublic変数](../scripts/public-properties-and-fields.md)を調整することができます。
|
|
|
+
|
|
|
+ 
|
|
|
+
|
|
|
+<!--
|
|
|
1. In the **Scene Editor**, select the entity that has the video component.
|
|
|
|
|
|
2. In the **Property Grid**, click **Add component** and select the video script.
|
|
|
@@ -119,7 +236,15 @@ myVideoComponent.Instance.Play();
|
|
|
You can adjust [public variables you define in the script](../scripts/public-properties-and-fields.md) in the **Property Grid** under the script component properties.
|
|
|
|
|
|

|
|
|
+-->
|
|
|
|
|
|
+## 関連項目
|
|
|
+<!--
|
|
|
## See also
|
|
|
+-->
|
|
|
+
|
|
|
+* [ビデオのプロパティ](video-properties.md)
|
|
|
|
|
|
-* [Video properties](video-properties.md)
|
|
|
+<!--
|
|
|
+* [Video properties](video-properties.md)
|
|
|
+-->
|