Search Unity

Video movietexture issue

Discussion in 'Audio & Video' started by pippolo, Jul 18, 2017.

  1. pippolo

    pippolo

    Joined:
    Jul 18, 2017
    Posts:
    19
    Hi there, I'm new to Unity (using 5.6.2f1) and I've read a few discussion over the years about video issues but I still can't have video inside unity.
    So I tried .mp4, mwv and ogv and none of them works. Actually ogv it's the only format which doesn't throw errors, however I still can't link it to my movietexture (I get a forbidden icon when I try to link it to my variable, nothing in the console).
    If I apply the transcode I'll get a warning about an issue with 30 audio samples but that's it. the import seems to be fine as I can preview the video in the top left part of the screen.

    This is the simple script I am using (taken from this video
    )

    Any help please?

    Thank you!

    Code (csharp):
    1.  
    2. public class playVideo : MonoBehaviour {
    3.  
    4.     public MovieTexture movie;
    5.     private AudioSource audio;
    6.  
    7.    // Use this for initialization
    8.    void Start () {
    9.         GetComponent<RawImage>().texture = movie as MovieTexture;
    10.         audio = GetComponent<AudioSource>();
    11.         audio.clip = movie.audioClip;
    12.         movie.Play();
    13.         audio.Play();
    14.    }
    15.    
    16.    // Update is called once per frame
    17.    void Update () {
    18.        if(Input.GetKeyDown(KeyCode.Space) && movie.isPlaying)
    19.         {
    20.             movie.Pause();
    21.         }
    22.         else
    23.         {
    24.             movie.Play();
    25.         }
    26.    }
    27. }
    28.  
     
  2. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,305
    don't use MovieTexture, it's outdated
    since you're using 5.6, there's new VideoPlayer component; which has its own share of (mostly non showstopping) issues, but support for native playback and codecs is better
     
  3. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    What operating system are you using? I am using OSX 10.9.5 and it crashes every time when pressing play in the VideoComponent. I think it only works for OSX 10.10 above.