12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class VideoPlayBtn : MonoBehaviour
- {
- public GameObject Icon;
- public bool m_IsPlaying;
- public AVProVideoPlayer m_Video;
- public string spid = null;
- public string videoid = null;
- private void Start()
- {
- if (m_Video == null)
- m_Video = GetComponent<AVProVideoPlayer>();
- }
- public void PlayVideo()
- {
- if (m_Video == null)
- m_Video = GetComponent<AVProVideoPlayer>();
- TemplateVideo.temQueue = new Queue<TemplateVideo>();
- TemplateVideo.isPlaying = false;
- GameManager.Instance.avplayer = null;
- 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;
- if (spid != null&& m_Video!=null&& !UserInfo.Instance.is20)
- MQTTClient.Instance.sendActiveVideo(spid, videoid, m_IsPlaying, -1);
- }
- public void PlayVideoAuto()
- {
- if (m_Video == null)
- m_Video = GetComponent<AVProVideoPlayer>();
- TemplateVideo.isPlayLock = true;
- 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;
- if (spid != null && m_Video != null && !UserInfo.Instance.is20)
- MQTTClient.Instance.sendActiveVideo(spid, videoid, m_IsPlaying, -1);
- }
- }
|