アラキタウン

黒歴史や生き恥を切り売り

assetbundleからUnityVideoPlayerを再生しようとした際、OpenExtractor could not translate archive:/〇〇.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed. 

android環境でassetbundleからUnityVideoPlayerを再生しようとした際、以下のエラーが発生した。

AndroidVideoMedia::OpenExtractor could not translate archive:/〇〇.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed. 
AndroidVideoMedia: Error opening extractor: -10004 

訳すると、
OpenExtractor はローカル ファイルに変換できませんでした。ファイルが存在し、ディスク上にあり (メモリ内ではなく)、圧縮されていないことを確認してください。

 

assetbundle Browserでは無圧縮に設定されている。

 

バージョンの問題かとも考えた、

 

今回の取り組んでいるandroidのバージョンは12

以下のunityの公式のページには、

docs.unity3d.com

 

Android Pie and above, Unity supports playback from compressed asset bundles.
Android Pie以降の場合、Unity は圧縮されたアセット バンドルからの再生をサポートします。

 

12なので関係ない。

Note: Not all devices support resolutions greater than 640 × 360.
注: すべてのデバイスが 640 × 360 を超える解像度をサポートしているわけではありません。

念のため、640×360の解像度にしてみてもエラーメッセージは変わらず。

 

改修元のスクリプトを見るとアセットバンドルの読み取りが、、
AssetBundle.LoadFromMemory()となっていた。
AssetBundle.LoadFromFile()に変更すると読み取れ、再生できました。

なぜローカルのファイル読み込みでLoadFromMemoryを使っていたのか・・・