using System; using System.IO; using UnityEngine; using UnityEngine.UI; using UnityEngine.Serialization; using Agora.Rtc; using Agora.Util; using Logger = Agora.Util.Logger; namespace Agora_RTC_Plugin.API_Example.Examples.Advanced.MediaPlayer { public class MediaPlayerExample : MonoBehaviour { [FormerlySerializedAs("appIdInput")] [SerializeField] private AppIdInput _appIdInput; [Header("_____________Basic Configuration_____________")] [FormerlySerializedAs("APP_ID")] [SerializeField] private string _appID = ""; [FormerlySerializedAs("TOKEN")] [SerializeField] private string _token = ""; [FormerlySerializedAs("CHANNEL_NAME")] [SerializeField] private string _channelName = ""; public Text LogText; internal Logger Log; internal IRtcEngine RtcEngine = null; internal IMediaPlayer MediaPlayer = null; private const string MPK_URL = "https://agoracdn.s3.us-west-1.amazonaws.com/videos/Agora.io-Interactions.mp4"; private const string PRELOAD_URL = "https://agoracdn.s3.us-west-1.amazonaws.com/videos/Agora+Quality+Comparison+Jellyfish.mp4"; private Button _button1; private Button _button2; private Button _button3; private Button _button4; private Button _button5; private Button _button6; private Button _button7; private Button _button8; private Button _button9; private Toggle _urlToggle; private Toggle _loopToggle; private InputField _inputField; // Use this for initialization private void Start() { LoadAssetData(); if (CheckAppId()) { SetUpUI(); EnableUI(false); InitEngine(); InitMediaPlayer(); JoinChannelWithMPK(); } } // Update is called once per frame private void Update() { PermissionHelper.RequestMicrophontPermission(); PermissionHelper.RequestCameraPermission(); } private void SetUpUI() { _button1 = GameObject.Find("Button1").GetComponent