- Home /
The question is answered, right answer was accepted
Is it possible to load a VideoClip at runtime from streaming assets
I've been working with Unity 5.6's new video player and so far it's been great! Currently I've been trying to load a video at runtime from the streaming assets folder so that the video in the build can be updated without having to create a new build. I know this was possible with the previous MovieTexture system and I had been using AV_Pro to work with non .ogg videos.
I checked out https://docs.unity3d.com/560/Documentation/ScriptReference/Video.VideoPlayer.html and while it does mention loading videos from a File://. The VideoImporter inherits from the unityEditor class so I can't use it at runtime.
Loading it as an asset bundle won't work either since I need to just support drag and drop functionality for new videos in the streamingAssets folder
Maybe I just overlooked something?
Edit: I tried using the URL but I'm just getting the error Can't play movie [] https://docs.unity3d.com/560/Documentation/ScriptReference/Video.VideoSource.Url.html
vPlayer.url = Application.streamingAssetsPath + "/testMovie.mp4";
I figured out what I was doing wrong in case anyone is ever wondering this is how you need to construct your file path.
vPlayer.url = "file://" + Application.strea$$anonymous$$gAssetsPath + "/test$$anonymous$$ovie.mp4";
Same issue, getting same error when trying to play a video url at runtime.
"The Android VideoPlayer cannot yet read videos from asset bundles." https://unity3d.com/unity/whats-new/unity-5.6.0
Use Easy $$anonymous$$ovie Texture in the mean time.
For android, remove "file://": vPlayer.url =Application.strea$$anonymous$$gAssetsPath + "/test$$anonymous$$ovie.mp4"; Hope that helps!