Search Unity

Video vp.url = "file:/// with .ogv movies doesn't works on my macintosh since version 2018 3.6

Discussion in 'Audio & Video' started by yannminh, Mar 4, 2019.

  1. yannminh

    yannminh

    Joined:
    Jul 1, 2007
    Posts:
    43
    Hello,
    I wrote this page of code, using the Unity Video Player https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class DownloadMovieVP : MonoBehaviour
    4. {
    5.     void Start()
    6.     {
    7.         var vp = gameObject.AddComponent<UnityEngine.Video.VideoPlayer>();
    8.     vp.url = "http://www.noochannel.com/noomuseum/mov/Magneto-400.ogv";
    9.  
    10.         vp.isLooping = true;
    11.         vp.renderMode = UnityEngine.Video.VideoRenderMode.MaterialOverride;
    12.         vp.targetMaterialRenderer = GetComponent<Renderer>();
    13.         vp.targetMaterialProperty = "_MainTex";
    14.      
    15.         vp.Play();
    16.     }
    17. }
    and it works fine,

    but when I want to link to an URL to my Hard Disk like : vp.url = "file:///Magneto-400.ogv" or file://Magneto-400.ogv or any other folder in my HD like : file:///noomuseum/mov/Magneto-400.ogv it doesn't work ...


    It does'nt works with Vorbis .ogv movies, but it works with .mp4 movies.

    It seems that Vorbis movies can't be play when they are on a hard disk, and not online on a webserver ?

    Is there an easy way to solve this problem, because I have hundred of movies in Vorbis.ogv in my database and it would be great if I don't have to convert all of them in .mp4 and change all the scripts codes...

    Thanks very much for your help :)
     
  2. yannminh

    yannminh

    Joined:
    Jul 1, 2007
    Posts:
    43
    Ok, I resolve the problem by myself... it was simple... and written in the first exemple script here : https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html

    For a mysterious reason, to read an Vorbis .ogv file in my HD, the url in the video player component or script must' not be written like that : file:///mymovie.ogv/
    but like that : /mymovie.ogv/ if "mymovie.ogv" is on the first level of the HardDisk,
    if "mymovie.ogv" is in the user folder, the url must be written like that : /Users/mymovie.ogv

    Hope that help...