UI controls for video

I am trying to make a set of controls (pause/play) for a video in unity world space, with this much so far…

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
[RequireComponent (typeof(AudioSource))]

public class playVideo : MonoBehaviour {

public MovieTexture movie;
public AudioSource audio;
public bool playVid = true;

// Use this for initialization
void Start () {
	{
					GetComponent<RawImage> ().texture = movie as MovieTexture;
					audio = GetComponent<AudioSource> ();
					audio.clip = movie.audioClip;
					movie.Pause ();
					audio.Pause ();

}

public void playIt(){

			if (playVid = false) 
			{
					movie.Pause ();
					audio.Pause ();
	
			} 
	else if (playVid = true) 
			{
					movie.Play ();
					audio.Play ();		
			}
	}

}

but I can’t get a button click to change the bool state, any ideas?
Thanks for the help !

make a canvas . add toggle in it . change your script like this :

void Start()
    {
        playVid=false;
    }

void Update()
    {
        if(playVid==true)
            {
                movie.Play ();
                audio.Play ();  
            }
        else
            {
                movie.Pause ();
                audio.Pause ();
            }
    }
                

public void playIt()
    {
        playVid=!playVid;
    }

and link this playIt method to your toggle button .

I hope it works .

edit : I added playVid=false; to void Start(). can you try this ? let me know if it works .