Video Player コンポーネント は、さまざまなソースからインポートしたコンテンツを再生できます。
ビデオクリップアセットを作成し使用するには、最初にビデオファイルをインポートする必要があります。
ビデオファイルを Project ウィンドウにドラッグアンドドロップして、ビデオクリップを作成します。
ビデオクリップを作成するもう1 つの方法は、Assets > Import New Asset… でビデオファイルをインポートします。
インポート後、新しく作成されたビデオクリップは、 Select VideoClip ウィンドウ (Video Clip フィールドの右側にある円い選択ボタンをクリックしてアクセス可能) で、または、Video Player コンポーネントの対応するフィールドにビデオクリップアセットをドラッグアンドドロップして選択できます。
Source のドロップダウンメニューを使用して、ビデオソースを URL に設定します (このプロパティはデフォルトで Video Clip に設定されています)。 Source を URL に設定すると、file:// プレフィックスの有無にかかわらず、ファイルシステムのファイルを直接使用することが可能になります。
URL オプションは、Asset 管理をバイパスします。つまり、Unity によってソースビデオが検出されることを手動で確認する必要があります。例えば、ウェブの URL にはソースビデオをホストするためのウェブサーバーが必要ですが、通常のファイルは、スクリプトで示して Unity が見つけることができる場所に配置しなくてはなりません。ただし、これは、コンテンツが Unity の直接管理下にない場合や、大きなビデオファイルをローカルに保存することを避けたい場合に便利です。
Video Player のコンポーネントの Source を URL に設定すると、http:// と https:// を通してウェブソースからの動画の読み込みにも使用できます。このような場合、Unity は必要な事前バッファリングとエラー管理を実行します。
ビデオクリップは アセットバンドル からも読み込むことができます。
インポート後、Video Player コンポーネントの Video Clip フィールドに割り当てることによって、ビデオクリップを使用できます。
Unity の StreamingAssets フォルダーに配置したファイルは Video Player コンポーネントの URL オプション (前述を参照) を通して使用するか、プラットフォーム特有のパス (Application.streamingAssetsPath) を通して使用できます。
2017–06–15 公開ページ
5.6 の新機能
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.