How do I solve the WindowsVideoMedia error when importing video files to Unity5?

0

I am quite new to Untiy Scripting and have encountered the WindowsVideoMedia error 0x80070002 when trying to load a Videoclip into the Video Player with the "videoPlayer.url" command.

Every time I try to use the "url" method to access any video from my PC or even the Project Assets folder the WindowsVideoMedia error occurs and is followed by

VideoPlayer cannot play: url: /videoname.mp4

(using Unity 2018.3.7f1 Personal)

The video files work perfectly fine when inserting them manually in the Video Player interface - both as URL and a Clip.

I've been trying all sorts of solutions I found online, but the only thing that worked until now was streaming a video from a website (doesn't really solve my problem...).

Tried various different file locations, such as streaming Assets folder, relative paths and absolute paths. Also tried two different video files that both work perfectly when not accessed via scripting.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;

public class LoadVideo : MonoBehaviour {


    void Start () {


        var videoPlayer = gameObject.AddComponent<UnityEngine.Video.VideoPlayer>();
        videoPlayer.playOnAwake = false;

        videoPlayer.source = VideoSource.Url;

       /* None of the following methods seems to be working properly...*/
       // videoPlayer.url = "ricoh";
       // videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "ricoh.mp4");
       // videoPlayer.url = "Ressources/Videos/ricoh";
       // videoPlayer.url = "/Users/TW/Videos/ricoh_1.mp4";
       // videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "/ricoh_01.mp4");

       /*only the web-stream seems functional but doesn't really help me at all as I'm looking for a local solution*/
        videoPlayer.url = "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4";




 videoPlayer.Play();
 }


}

I expect the video file to be streamed from a local folder and be playable as a video clip on the Unity 5 Video Player. But I only get the "WindowsVideoMedia error 0x80070002" followed by VideoPlayer cannot play: url: /videoname.mp4 ​

c#
unity3d
runtime-error
asked on Stack Overflow Apr 5, 2019 by Teh Weh • edited Apr 12, 2019 by Teh Weh

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0