MP4 Play on Drawtexture

Source: Internet
Author: User


This script is hung under plane to hang the audio sourse and audio listener components on this object to play the video properly. These two components hang on the camera and cannot play the video.

Using Unityengine;
Using System.Collections;

public class Testmp4b:monobehaviour {

Movie Textures
Public Movietexture mov;

void Start ()
{

Audio.clip = Mov.audioclip;
Audio. Play ();
mov. Play ();

Set the movie texture playback mode to loop
Mov.loop = true;

}

void Ongui ()
{
if (GUI. button (new Rect (310,0,100,50), "twice Times Playback"))
{
Audio.pitch = 2f;
}

if (GUI. button (new Rect (410,0,100,50), "1 time Times Playback"))
{
Audio.pitch = 1f;
}

Gui. Drawtexture (New Rect (0,0,300,300), MOV);

Draw a movie texture
Gui. Drawtexture (New Rect (0, 0, Screen.width, screen.height), MOV, Scalemode.stretchtofill);

if (Guilayout.button ("Play/Continue"))
{
Play/Resume Video
if (!mov.isplaying)
{
mov. Play ();
}

}

if (Guilayout.button ("Pause playback"))
{
Pause Playback
mov. Pause ();
}

if (Guilayout.button ("Stop playing"))
{
Stop playing
mov. Stop ();
}
}


}

MP4 Play on Drawtexture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.