MyblogAd

Thursday, June 30, 2016

unity code to display video

********adding a avideo to a scean**************

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

public class playvideo : MonoBehaviour {
    public MovieTexture movie;
    private AudioSource audio;

    // Use this for initialization
    void Start () {

//        GetComponent<RawImage> ().texture = movie as MovieTexture;
//        audio= GetComponent<AudioSource>();
//        audio.clip = movie.audioClip;
//        movie.Play ();
//        audio.Play ();
    }
    void awake()
    {
        if (Advertisement.IsReady ()) {
           
            Advertisement.Show();
        }
        else {
            Debug.Log("advertisement is not ready");
        }
    }
   
    // Update is called once per frame
    void Update () {
//    if(Input.GetKeyDown("space")&& movie.isPlaying)
//        {
//            movie.Pause();
//                    }
//        else if(Input.GetKeyDown("space")&& !movie.isPlaying)
//        {
//            movie.Play();
//        }
    }
}

********adding simple level ****************
using UnityEngine;
using System.Collections;

public class level : MonoBehaviour {

    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {
   
    }

    public void applicationLevel()
    {
        Application.LoadLevel ("techvideo");

    }
}

No comments:

Post a Comment