void WriteToFile(string filename, byte[] bytes)
 {
     try
     {
         File.WriteAllBytes(AddApplicationRootPath(filename), bytes);
     }
     catch (IOException e)
     {
         string errorMSG = string.Format("[WriteToFile] ERROR :: Failed to save your movie because an error occured when using the disk: {0}", e.Message);
         debugger.log(errorMSG);
         throw new WriteToFileException(errorMSG, e);
     }
 }
Beispiel #2
0
        /*
         *  PRIVATE
         */

        IEnumerator DownloadFile(string url, Action <WWW> onCompleteCallback, Action <float> onProgressUpdateCallback = null)
        {
            WWW www = new WWW(url);

            if (onProgressUpdateCallback != null)
            {
                StartCoroutine(ShowProgress(www, onProgressUpdateCallback));
            }

            while (!www.isDone)
            {
                yield return(www);
            }

            if (!string.IsNullOrEmpty(www.error))
            {
                string errorMSG = string.Format("[DownloadFile] ERROR :: Failed to download file from url {0} because an error occurred: {1}", url, www.error);
                debugger.log(errorMSG);
                throw new DownloadFailedException(errorMSG);
            }

            onCompleteCallback(www);
        }
        /*
         *  PUBLIC
         */

        public void Play(string fullPath, Action MovieFinished)
        {
            debugger.log("[MoviePlayer] play => 'file://" + fullPath + "'");

            StartCoroutine(Playback(fullPath, MovieFinished));
        }