1234567891011121314151617181920212223242526272829303132333435 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class VideoPlayBtn : MonoBehaviour
- {
- public GameObject Icon;
- public bool m_IsPlaying;
- public AVProVideoPlayer m_Video;
- private void Start()
- {
- if (m_Video == null)
- m_Video = GetComponent<AVProVideoPlayer>();
- }
- public void PlayVideo()
- {
- Debug.Log("m_IsPlaying: " + m_IsPlaying);
- if (m_Video == null)
- return;
- Debug.Log(m_Video.GetUrl());
- if (!m_IsPlaying)
- {
- // FengMian.gameObject.SetActive(false);
- m_Video.Play();
- Icon.SetActive(false);
- }
- else
- {
- m_Video.Pause();
- Icon.SetActive(true);
- }
- m_IsPlaying = !m_IsPlaying;
- }
- }
|