51 lines
970 B
C#
51 lines
970 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.Video;
|
||
|
|
|
||
|
|
public class VideoController : MonoBehaviour
|
||
|
|
{
|
||
|
|
|
||
|
|
public VideoPlayer videoPlayer;
|
||
|
|
|
||
|
|
public bool ifPlay=false;
|
||
|
|
private bool ifPlaying = false;
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
videoPlayer.url = Application.streamingAssetsPath + "/video_HNT.mp4";
|
||
|
|
}
|
||
|
|
// Start is called before the first frame update
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
ifPlay = false;
|
||
|
|
ifPlaying = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
if (ifPlay&&!ifPlaying)
|
||
|
|
{
|
||
|
|
videoPlayer.Stop();
|
||
|
|
videoPlayer.Play();
|
||
|
|
ifPlaying = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (ifPlaying&&!ifPlay)
|
||
|
|
{
|
||
|
|
videoPlayer.Stop();
|
||
|
|
videoPlayer.Play();
|
||
|
|
ifPlaying = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|