示例#1
0
        private bool OpenVideoFromFile()
        {
            bool result = false;

            XDebugger.Log("m_Control =" + m_Control);
            // Open the video file
            if (m_Control != null)
            {
                CloseVideo();

                m_VideoOpened                = true;
                m_AutoStartTriggered         = !m_AutoStart;
                m_EventFired_MetaDataReady   = false;
                m_EventFired_ReadyToPlay     = false;
                m_EventFired_Started         = false;
                m_EventFired_FirstFrameReady = false;

                // Potentially override the file location
                string fullPath = GetPlatformFilePath(GetPlatform(), ref m_VideoPath, ref m_VideoLocation);
                XDebugger.Log("fullPath =" + fullPath);
                if (!string.IsNullOrEmpty(m_VideoPath))
                {
                    bool checkForFileExist = true;
                    if (fullPath.Contains("://"))
                    {
                        checkForFileExist = false;
                    }
#if (UNITY_ANDROID)
                    checkForFileExist = false;
#endif

                    if (checkForFileExist && !System.IO.File.Exists(fullPath))
                    {
                        Debug.LogError("[AVProVideo] File not found: " + fullPath, this);
                        XDebugger.Log("[AVProVideo] File not found: " + fullPath);
                    }
                    else
                    {
                        Debug.Log("[AVProVideo] Opening " + fullPath);
                        XDebugger.Log("[AVProVideo] Opening " + fullPath);
                        if (!m_Control.OpenVideoFromFile(fullPath))
                        {
                            Debug.LogError("[AVProVideo] Failed to open " + fullPath, this);
                            XDebugger.Log("[AVProVideo] Failed to open " + fullPath);
                        }
                        else
                        {
                            SetPlaybackOptions();
                            result = true;
                        }
                    }
                }
                else
                {
                    Debug.LogError("[AVProVideo] No file path specified", this);
                    XDebugger.Log("[AVProVideo] No file path specified");
                }
            }
            return(result);
        }
示例#2
0
        private string GetPlatformFilePath(Platform platform, ref string filePath, ref FileLocation fileLocation)
        {
            string result = string.Empty;

            XDebugger.Log(" GetPlatformFilePath.path ");
            // Replace file path and location if overriden by platform options
            if (platform != Platform.Unknown)
            {
                PlatformOptions options = GetPlatformOptions(platform);
                XDebugger.Log(" options = " + options);
                if (options != null)
                {
                    if (options.overridePath)
                    {
                        XDebugger.Log(" options.path =" + options.path);
                        XDebugger.Log(" options.pathLocation =" + options.pathLocation);
                        filePath     = options.path;
                        fileLocation = options.pathLocation;
                    }
                }
            }

            result = GetFilePath(filePath, fileLocation);
            XDebugger.Log("GetFilePath() result=" + result);
            return(result);
        }
示例#3
0
 void IOSBack2(string videoTime)
 {
     debug.text += "视频时长:" + videoTime;
     XDebugger.Log("视频时长:" + videoTime);
     XDebugger.Log("真机的宽高:" + Screen.width + "," + Screen.height);
     XDebugger.Log("dpi:" + Screen.dpi);
 }
示例#4
0
        public bool OpenVideoFromFile(FileLocation location, string path, bool autoPlay = true)
        {
            m_VideoLocation = location;
            m_VideoPath     = path;
            m_AutoStart     = autoPlay;
            XDebugger.Log("m_VideoPath =" + m_VideoPath);
            if (m_Control == null)
            {
                Initialise();
            }

            return(OpenVideoFromFile());
        }
示例#5
0
    IEnumerator LoadVideo2(string url)
    {
        try
        {
            mediaPlayer.m_VideoPath = url; //"video_1.mp4";
            bool isOpenVideoFromFile = mediaPlayer.OpenVideoFromFile(mediaPlayer.m_VideoLocation, mediaPlayer.m_VideoPath, mediaPlayer.m_AutoStart);
            mediaPlayer.Control.MuteAudio(false);
            mediaPlayer.Control.SetLooping(true);

            XDebugger.Log("isOpenVideoFromFile =" + isOpenVideoFromFile);
        }
        catch (System.Exception e)
        {
            XDebugger.Log("Exception =" + e.Message);
        }
        yield return(mediaPlayer);
    }
示例#6
0
    IEnumerator LoadVideo(string url)
    {
        byte[]  bytes = System.Convert.FromBase64String(url);
        WWWForm form  = new WWWForm();

        form.AddBinaryData("myFile", bytes, "Temp.mp4");
        using (var w = UnityWebRequest.Post("http://172.16.1.131:8080/test_upload.php", form))
        {
            yield return(w.SendWebRequest());

            if (w.isNetworkError || w.isHttpError)
            {
                debug.text = w.error;
                XDebugger.Log(w.error);
            }
            else
            {
                debug.text = "Finished Uploading Screenshot";
                XDebugger.Log("Finished Uploading Screenshot");
            }
        }
    }
示例#7
0
 private int ScaleFactor = 2;  //设备分辨率/逻辑分辨率
 private void Start()
 {
     XDebugger.Log("Start");
 }