コード例 #1
0
    private IEnumerator UniGifProcessorLoad(string url, Action <GifFrameData[]> OnSuccess, Action OnFail)
    {
        webRequest = UnityWebRequest.Get(url);
        yield return(webRequest.SendWebRequest());;

        bool success = webRequest != null && webRequest.WebRequestSucceded();

        if (success)
        {
            var bytes = webRequest.downloadHandler.data;
            yield return(UniGif.GetTextureListCoroutine(bytes,
                                                        (frames, loopCount, width, height) =>
            {
                if (frames != null)
                {
                    OnSuccess?.Invoke(frames);
                }
                else
                {
                    OnFail?.Invoke();
                }
            }));
        }
        else
        {
            OnFail?.Invoke();
        }
        webRequest.Dispose();
        webRequest = null;
    }
コード例 #2
0
    private IEnumerator UniGifProcessorLoad(string url, Action<GifFrameData[]> OnSuccess, Action OnFail)
    {
        webRequestOp = DCL.Environment.i.platform.webRequest.Get(url: url, disposeOnCompleted: false);

        yield return webRequestOp;

        if (webRequestOp.isSucceded)
        {
            var bytes = webRequestOp.webRequest.downloadHandler.data;
            yield return UniGif.GetTextureListCoroutine(bytes,
                (frames, loopCount, width, height) =>
                {
                    if (frames != null)
                    {
                        OnSuccess?.Invoke(frames);
                    }
                    else
                    {
                        OnFail?.Invoke();
                    }
                });
        }
        else
        {
            OnFail?.Invoke();
        }

        webRequestOp.Dispose();
    }
コード例 #3
0
    IEnumerator getFile()
    {
        indexData = UnityEngine.Random.Range(1, urls.Count);
        m_gifTexList.Clear();
        WWW www = new WWW(url + urls[indexData]);

        while (!www.isDone)
        {
            yield return(null);
        }
        text.text = "File:" + urls[indexData] + "(" + indexData + "/" + urls.Count + ")";

        int loop, w, h;

        try
        {
            m_gifTexList = UniGif.GetTextureList(www.bytes, out loop, out w, out h, m_filterMode, m_wrapMode, m_outputDebugLog);

            StartCoroutine(GifLoopCoroutine());
        }
        catch (IndexOutOfRangeException)
        {
            StartCoroutine(getFile());
        }
    }
コード例 #4
0
ファイル: UniGifImage.cs プロジェクト: rickho886/Mission169
    /// <summary>
    /// Set GIF texture from url
    /// </summary>
    /// <param name="url">GIF image url (WEB or StreamingAssets path)</param>
    /// <param name="autoPlay">Auto play after decode</param>
    /// <returns>IEnumerator</returns>
    public IEnumerator SetGifFromUrlCoroutine(string url, bool autoPlay = true)
    {
        if (string.IsNullOrEmpty(url))
        {
            UnityEngine.Debug.LogError("URL is nothing.");
            yield break;
        }

        m_loading = true;

        string path;

        if (url.StartsWith("http"))
        {
            // from WEB
            path = url;
        }
        else
        {
            // from StreamingAssets
            path = System.IO.Path.Combine("file:///" + Application.persistentDataPath, url);
        }

        // Load file
        using (WWW www = new WWW(path))
        {
            yield return(www);

            if (string.IsNullOrEmpty(www.error) == false)
            {
                UnityEngine.Debug.LogError("File load error.\n" + www.error);
            }
            else
            {
                m_gifTexList.Clear();

                // Get GIF textures
                if (m_useCoroutineGetTexture)
                {
                    print("here!!!!~");
                    // use coroutine (avoid lock up but more slow)
                    yield return(StartCoroutine(UniGif.GetTextureListCoroutine(this, www.bytes, (gtList, loop, w, h) =>
                    {
                        m_gifTexList = gtList;
                        FinishedGetTextureList(loop, w, h, autoPlay);
                    }, m_filterMode, m_wrapMode, m_outputDebugLog)));
                }
                else
                {
                    // dont use coroutine (there is a possibility of lock up)
                    int loop, w, h;
                    m_gifTexList = UniGif.GetTextureList(www.bytes, out loop, out w, out h, m_filterMode, m_wrapMode, m_outputDebugLog);
                    FinishedGetTextureList(loop, w, h, autoPlay);
                }
            }
        }
    }
コード例 #5
0
    /// <summary>
    /// Set GIF texture from url
    /// </summary>
    /// <param name="url">GIF image url (WEB or StreamingAssets path)</param>
    /// <param name="autoPlay">Auto play after decode</param>
    /// <returns>IEnumerator</returns>
    public IEnumerator SetGifFromUrlCoroutine(string url, bool autoPlay = true)
    {
        if (string.IsNullOrEmpty(url))
        {
            Debug.LogError("URL is nothing.");
            yield break;
        }

        loading = true;

        string path;

        if (url.StartsWith("http"))
        {
            // from WEB
            path = url;
        }
        else
        {
            // from StreamingAssets
            path = System.IO.Path.Combine("file:///" + Application.streamingAssetsPath, url);
        }

        // Load file
        using (WWW www = new WWW("http://q.qlogo.cn/qqapp/1104827980/6A620F446800E6A4C0970D9C7A78CDE5/100"))
        {
            yield return(www);

            if (string.IsNullOrEmpty(www.error) == false)
            {
                Debug.LogError("File load error.\n" + www.error);
            }
            else
            {
                gifTexList.Clear();

                // Get GIF textures
                if (useCoroutineGetTexture)
                {
                    // use coroutine (avoid lock up but more slow)
                    yield return(StartCoroutine(UniGif.GetTextureListCoroutine(this, www.bytes, (gtList, loop, w, h) => {
                        gifTexList = gtList;
                        FinishedGetTextureList(loop, w, h, autoPlay);
                    }, filterMode, wrapMode, outputDebugLog)));
                }
                else
                {
                    // dont use coroutine (there is a possibility of lock up)
                    int loop, w, h;
                    gifTexList = UniGif.GetTextureList(www.bytes, out loop, out w, out h, filterMode, wrapMode, outputDebugLog);
                    FinishedGetTextureList(loop, w, h, autoPlay);
                }
            }
        }
    }
コード例 #6
0
        private IEnumerator BeginInitRes()
        {
            TextAsset[] gifTextAssets = Resources.LoadAll <TextAsset>("Raw/Gif");
            foreach (var gifTextAsset in gifTextAssets)
            {
                yield return(0);

                StartCoroutine(UniGif.GetTextureListCoroutine(this, gifTextAsset.bytes, gifTextAsset.GetInstanceID(), null, null,
                                                              FilterMode.Trilinear, TextureWrapMode.Clamp, false));
            }
        }
コード例 #7
0
        public IEnumerator Load(byte[] bytes, Action onFinish)
        {
            if (isLoaded)
            {
                Dispose();
            }

            yield return(UniGif.GetTextureListCoroutine(bytes, OnGifLoaded, FilterMode.Bilinear, TextureWrapMode.Clamp));

            onFinish?.Invoke();
        }
コード例 #8
0
    /// <summary>
    /// Get GIF texture list Coroutine (Avoid lock up but more slow)
    /// </summary>
    /// <param name="mb">MonoBehaviour to start the coroutine</param>
    /// <param name="bytes">GIF file byte data</param>
    /// <param name="cb">Callback method(param is GIF texture list, Animation loop count, GIF image width (px), GIF image height (px))</param>
    /// <param name="filterMode">Textures filter mode</param>
    /// <param name="wrapMode">Textures wrap mode</param>
    /// <param name="debugLog">Debug Log Flag</param>
    /// <returns>IEnumerator</returns>
    public static IEnumerator GetTextureListCoroutine(MonoBehaviour mb, byte[] bytes, Action <List <GifTexture>, int, int, int> cb,
                                                      FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, bool debugLog = false)
    {
        int loopCount = -1;
        int width     = 0;
        int height    = 0;

        // Set GIF data
        var gifData = new GifData();

        if (SetGifData(bytes, ref gifData, debugLog) == false)
        {
            Debug.LogError("GIF file data set error.");
            if (cb != null)
            {
                cb(null, loopCount, width, height);
            }
            yield break;
        }

        // avoid lock up
        yield return(0);

        // Decode to textures from GIF data
        List <GifTexture> gifTexList = null;

        yield return(mb.StartCoroutine(UniGif.DecodeTextureCoroutine(gifData, gtList =>
        {
            gifTexList = gtList;
        }, filterMode, wrapMode)));

        if (gifTexList == null)
        {
            Debug.LogError("GIF texture decode error.");
            if (cb != null)
            {
                cb(null, loopCount, width, height);
            }
            yield break;
        }

        loopCount = gifData.appEx.loopCount;
        width     = gifData.logicalScreenWidth;
        height    = gifData.logicalScreenHeight;

        if (cb != null)
        {
            cb(gifTexList, loopCount, width, height);
        }
    }
コード例 #9
0
ファイル: Asset_Gif.cs プロジェクト: yemel/explorer
        public IEnumerator Load()
        {
            if (isLoaded)
            {
                Dispose();
            }

            bool processedGIFInJS = false;

#if !UNITY_EDITOR && UNITY_WEBGL
            yield return(DCL.GIFProcessingBridge.i.RequestGIFProcessor(url,
                                                                       (List <UniGif.GifTexture> newTextures) => // Override textures with JS processed ones
            {
                if (newTextures == null || newTextures.Count == 0)
                {
                    return;
                }
                processedGIFInJS = true;
                OnGifLoaded(newTextures, 0, newTextures[0].m_texture2d.width, newTextures[0].m_texture2d.height);
            },
                                                                       () =>
            {
                processedGIFInJS = false;
            }));
#endif

            if (!processedGIFInJS)
            {
                byte[] bytes = null;

                yield return(Utils.FetchAsset(url, UnityWebRequest.Get(url), (request) => { bytes = request.downloadHandler.data; }));

                if (bytes == null)
                {
                    OnFailEvent?.Invoke();
                    yield break;
                }

                yield return(UniGif.GetTextureListCoroutine(bytes, OnGifLoaded));
            }

            SetMaxTextureSize(maxSize);
            Play();

            OnSuccessEvent?.Invoke(this, null);
        }
コード例 #10
0
            /// <summary> Creates Texture2D from given URI of a GIF file </summary>
            public static async Task <Texture2D> DownloadTextureGif(string url)
            {
                Assert.IsNotNull(url, "url is null");
                Assert.IsTrue(url.Length != 0, "url is of Length 0");

                using (var www = UnityWebRequest.Get(url))
                {
                    var asyncOp = www.SendWebRequest();
                    while (asyncOp.isDone == false)
                    {
                        await Task.Delay(100);
                    }

                    if (www.isNetworkError || www.isHttpError)
                    {
                                                #if DEBUG
                        Debug.LogError($"{www.error} at URL:{www.url}");
                                                #endif

                        return(null);
                    }
                    else
                    {
                        var    handle = www.downloadHandler;
                        byte[] bytes  = handle.data;

                        //var texture = new Texture2D();

                        var frames = await UniGif.GetTexturesAsync(bytes);

                        return(frames[0].m_texture2d);

                        //var r = DownloadHandlerBuffer.GetContent( www );

                        //return null;
                    }
                }
            }
コード例 #11
0
ファイル: SpriteSetter.cs プロジェクト: ubdirdoc/segment-game
    IEnumerator GifSetterCoroutine(string url, int orderInLayer = 0)
    {
        m_gifIsLoaded = false;

        m_gifSpriteList.Clear();

        if (GifPreLoader.instance.MustPreload())
        {
            List <GifSprite> currentGifSprite = GifPreLoader.instance.GetSpriteList(url);
            if (currentGifSprite != null)
            {
                m_gifSpriteList = currentGifSprite;
            }
        }

        if (m_gifSpriteList.Count == 0)
        {
            List <UniGif.GifTexture> gifTextureList = new List <UniGif.GifTexture> ();

            int loop;
            int width;
            int height;

            Debug.Log("Gif URL: " + url);
#if UNITY_WEBGL
            WWW www = new WWW(url);
#else
            WWW www = new WWW(/*"file:///" +*/ url);
#endif

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

            if (www.error != null)
            {
                GenericLog.Log(www.error);
            }

            gifTextureList = UniGif.GetTextureList(www.bytes, out loop, out width, out height, FilterMode.Bilinear);

            //List<GifSprite> gifSpriteList = new List<GifSprite>();

            foreach (UniGif.GifTexture gifTexture in gifTextureList)
            {
                GifSprite currentGifSprite = new GifSprite();

                Rect rect = new Rect();
                rect.center = new Vector2(0, 0);
                rect.height = height;
                rect.width  = width;

                currentGifSprite.delaySec     = gifTexture.delaySec;
                currentGifSprite.sprite       = Sprite.Create(gifTexture.texture2d, rect, new Vector2(0.5f, 0.5f), 1.0f);
                currentGifSprite.orderInLayer = orderInLayer;

                m_gifSpriteList.Add(currentGifSprite);

                yield return(null);
            }

            if (GifPreLoader.instance.MustPreload())
            {
                GifPreLoader.instance.SetNewGifSpriteList(url, m_gifSpriteList);
            }
        }

        m_isSpriteStopList.Clear();

        for (int i = 0; i < m_gifSpriteList.Count; ++i)
        {
            m_isSpriteStopList.Add(false);
        }

        //	UnableClickByClick();

        m_gifIsLoaded = true;
    }
コード例 #12
0
    public AnimUtil(string url, bool outputDebugLog = false, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Clamp)
    {
        int loop;

        gifTexList = UniGif.GetTextureList(Resources.Load <TextAsset>(url).bytes, out loop, out _w, out _h, filterMode, wrapMode, outputDebugLog);
    }
コード例 #13
0
ファイル: UniGifImage.cs プロジェクト: xujiangbeer/UniGif
    /// <summary>
    /// Set GIF texture from url
    /// </summary>
    /// <param name="url">GIF image url (WEB or StreamingAssets path)</param>
    /// <param name="autoPlay">Auto play after decode</param>
    /// <returns>IEnumerator</returns>
    public IEnumerator SetGifFromUrlCoroutine(string url, bool autoPlay = true)
    {
        if (string.IsNullOrEmpty(url))
        {
            Debug.LogError("URL is nothing.");
            yield break;
        }

        if (nowState == State.Loading)
        {
            Debug.LogWarning("Already loading.");
            yield break;
        }
        nowState = State.Loading;

        string path;

        if (url.StartsWith("http"))
        {
            // from WEB
            path = url;
        }
        else
        {
            // from StreamingAssets
            path = Path.Combine("file:///" + Application.streamingAssetsPath, url);
        }

        // Load file
        using (WWW www = new WWW(path))
        {
            yield return(www);

            if (string.IsNullOrEmpty(www.error) == false)
            {
                Debug.LogError("File load error.\n" + www.error);
                nowState = State.None;
                yield break;
            }

            Clear();
            nowState = State.Loading;

            // Get GIF textures
            yield return(StartCoroutine(UniGif.GetTextureListCoroutine(www.bytes, (gifTexList, loopCount, width, height) =>
            {
                if (gifTexList != null)
                {
                    m_gifTextureList = gifTexList;
                    this.loopCount = loopCount;
                    this.width = width;
                    this.height = height;
                    nowState = State.Ready;

                    m_imgAspectCtrl.FixAspectRatio(width, height);

                    if (m_rotateOnLoading)
                    {
                        transform.localEulerAngles = Vector3.zero;
                    }

                    if (autoPlay)
                    {
                        Play();
                    }
                }
                else
                {
                    Debug.LogError("Gif texture get error.");
                    nowState = State.None;
                }
            },
                                                                       m_filterMode, m_wrapMode, m_outputDebugLog)));
        }
    }
コード例 #14
0
    IEnumerator Start()
    {
        rootDirectory = Application.dataPath + "/../";

        if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
        {
            useWebMInsteadOfMp4 = true;
        }

        if (Application.platform == RuntimePlatform.OSXPlayer)
        {
            // OSX の場合にはアプリが別のパスに隔離されてしまうので問い合わせが必要
            var dir   = PlayerPrefs.HasKey("RootDirectory") ? PlayerPrefs.GetString("RootDirectory") : "";
            var paths = StandaloneFileBrowser.OpenFilePanel("audio.wav を選択してください", dir, "wav", false);
            if (paths.Length == 0)
            {
                Application.Quit();
                yield break;
            }

            rootDirectory = Uri.UnescapeDataString(Path.GetDirectoryName(paths[0]).Replace("file:", "") + "/");
            PlayerPrefs.SetString("RootDirectory", rootDirectory);
        }


        print("rootDir:" + rootDirectory);

        if (File.Exists(GetFilePath("background.png")))
        {
            print(GetFilePath("background.png"));
            var imageWWW = new WWW("file://" + GetFilePath("background.png"));
            yield return(imageWWW);

            image.texture = imageWWW.texture;
            SetResolution(imageWWW.texture.width, imageWWW.texture.height);
        }
        else if (File.Exists(GetFilePath("background.jpg")))
        {
            print(GetFilePath("background.jpg"));
            var imageWWW = new WWW("file://" + GetFilePath("background.jpg"));
            yield return(imageWWW);

            image.texture = imageWWW.texture;
            SetResolution(imageWWW.texture.width, imageWWW.texture.height);
        }
        else if (File.Exists(GetFilePath("background.gif")))
        {
            print(GetFilePath("background.gif"));
            var imageWWW = new WWW("file://" + GetFilePath("background.gif"));
            yield return(imageWWW);

            yield return(StartCoroutine(UniGif.GetTextureListCoroutine(imageWWW.bytes, (gifTexList, loopCount, width, height) =>
            {
                SetResolution(width, height);
                gifPlayer = GifPlayer.Create(image, gifTexList);
            })));
        }
        else
        {
            SetResolution(720, 304);
        }

        print(GetFilePath("audio.wav"));
        var audiosource = gameObject.AddComponent <AudioSource>();
        var audioWWW    = new WWW("file://" + GetFilePath("audio.wav"));

        yield return(audioWWW);

        audiosource.clip = audioWWW.GetAudioClip(false);

        var recorder = mp4Recorder;

        if (useWebMInsteadOfMp4)
        {
            recorder = webMRecorder;
        }

        recorder.outputDir = new DataPath(GetFilePath("Movie"));

        recorder.BeginRecording();
        if (gifPlayer != null)
        {
            gifPlayer.PlaySyncWith(audiosource);
        }
        audiosource.Play();
        print(LastPath);
        yield return(new WaitWhile(() => audiosource.isPlaying));

        recorder.EndRecording();

        yield return(new WaitForSeconds(2f));

        if (useWebMInsteadOfMp4)
        {
            var webmPath     = "\"" + LastPath + ".webm" + "\"";
            var mp4Path      = "\"" + LastPath + ".mp4" + "\"";
            var exeExtension = Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer ? ".exe" : "";
            var process      = Process.Start(GetFilePath("ffmpeg/ffmpeg" + exeExtension), "-i " + webmPath + " " + mp4Path);
            process.WaitForExit();
            File.Delete(LastPath + ".webm");
        }

        Application.Quit();
    }
コード例 #15
0
    /// <summary>
    /// Get GIF texture list Coroutine (Avoid lock up but more slow)
    /// </summary>
    /// <param name="mb">MonoBehaviour to start the coroutine</param>
    /// <param name="bytes">GIF file byte data</param>
    /// <param name="cb">Callback method(param is GIF texture list, Animation loop count, GIF image width (px), GIF image height (px))</param>
    /// <param name="filterMode">Textures filter mode</param>
    /// <param name="wrapMode">Textures wrap mode</param>
    /// <param name="debugLog">Debug Log Flag</param>
    /// <returns>IEnumerator</returns>
    public static IEnumerator GetTextureListCoroutine(MonoBehaviour mb, byte[] bytes, int instanceId, List <GifTexture> gifTexList,
                                                      Action <List <GifTexture>, int, int, int> cb, FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, bool debugLog = false)
    {
        int loopCount = -1;
        int width     = 0;
        int height    = 0;

        if (gifTexList == null)
        {
            gifTexList = new List <GifTexture>();
        }
        else
        {
            gifTexList = gifDict[instanceId].textureList;
        }

        if (!gifDict.ContainsKey(instanceId))
        {
            // Set GIF data
            var gifData = new GifData();
            if (SetGifData(bytes, ref gifData, debugLog) == false)
            {
                Debug.LogError("GIF file data set error.");
                if (cb != null)
                {
                    cb(null, loopCount, width, height);
                }
                yield break;
            }

            loopCount = gifData.appEx.loopCount;
            width     = gifData.logicalScreenWidth;
            height    = gifData.logicalScreenHeight;

            Debug.Log("loopCount " + loopCount);

            gifDict.Add(instanceId, new GifAnimation
            {
                loopCount   = loopCount,
                width       = width,
                height      = height,
                textureList = gifTexList,
            });

            // avoid lock up
            yield return(0);

            // Decode to textures from GIF data
            yield return(mb.StartCoroutine(UniGif.DecodeTextureCoroutine(gifData, gifTexList, filterMode, wrapMode)));
        }

        if (cb != null)
        {
            //Debug.Log(gifDict[instanceId].textureList.Count + " " + gifDict[instanceId].loopCount);
            //if (gifDict[instanceId].textureList.Count == gifDict[instanceId].loopCount)
            //{
            loopCount  = gifDict[instanceId].loopCount;
            width      = gifDict[instanceId].width;
            height     = gifDict[instanceId].height;
            gifTexList = gifDict[instanceId].textureList;

            cb(gifTexList, loopCount, width, height);
            //    yield break;
            //}
            //yield return new WaitForSeconds(0.1f);
        }
    }
コード例 #16
0
    /// <summary>
    /// Set GIF texture from url
    /// </summary>
    /// <param name="url">GIF image url (WEB or StreamingAssets path)</param>
    /// <param name="autoPlay">Auto play after decode</param>
    /// <returns>IEnumerator</returns>
    public IEnumerator SetGifFromUrlCoroutine(string url, bool autoPlay = true)
    {
        if (gifTextAsset != null)
        {
            if (gifTexList.Count != 0 && rawImage != null)
            {
                rawImage.texture = gifTexList[0].texture2d;
            }

            yield return(StartCoroutine(UniGif.GetTextureListCoroutine(this, gifTextAsset.bytes, gifTextAsset.GetInstanceID(), gifTexList, (gtList, loop, w, h) =>
            {
                gifTexList = gtList;
                FinishedGetTextureList(loop, w, h, autoPlay);
            }, filterMode, wrapMode, outputDebugLog)));

            yield break;
        }

        if (string.IsNullOrEmpty(url))
        {
            Debug.LogError("URL is nothing.");
            yield break;
        }

        loading = true;

        string path;

        if (url.StartsWith("http"))
        {
            // from WEB
            path = url;
        }
        else
        {
            // from StreamingAssets
            path = System.IO.Path.Combine("file:///" + Application.streamingAssetsPath, url);
        }

        // Load file
        using (WWW www = new WWW(path)) {
            yield return(www);

            if (string.IsNullOrEmpty(www.error) == false)
            {
                Debug.LogError("File load error.\n" + www.error);
            }
            else
            {
                gifTexList.Clear();

                // Get GIF textures
                if (useCoroutineGetTexture)
                {
                    // use coroutine (avoid lock up but more slow)
                    yield return(StartCoroutine(UniGif.GetTextureListCoroutine(this, www.bytes, (gtList, loop, w, h) => {
                        gifTexList = gtList;
                        FinishedGetTextureList(loop, w, h, autoPlay);
                    }, filterMode, wrapMode, outputDebugLog)));
                }
                else
                {
                    // dont use coroutine (there is a possibility of lock up)
                    int loop, w, h;
                    gifTexList = UniGif.GetTextureList(www.bytes, out loop, out w, out h, filterMode, wrapMode, outputDebugLog);
                    FinishedGetTextureList(loop, w, h, autoPlay);
                }
            }
        }
    }
コード例 #17
0
    /// <summary>
    /// Set GIF texture from url
    /// </summary>
    /// <param name="url">GIF image url (WEB or StreamingAssets path)</param>
    /// <param name="autoPlay">Auto play after decode</param>
    /// <returns>IEnumerator</returns>
    public IEnumerator SetGifFromUrlCoroutine(string url, bool autoPlay = true)
    {
        if (string.IsNullOrEmpty(url))
        {
            Debug.LogError("URL is nothing.");
            yield break;
        }

        loading = true;

        string path;

        if (url.StartsWith("http"))
        {
            // from WEB
            path = url;
        }
        else
        {
            // from StreamingAssets
            path =
#if true
#if UNITY_ANDROID && !UNITY_EDITOR
                System.IO.Path.Combine(Application.streamingAssetsPath, url);
            //"jar:file://" + Application.dataPath + "!/assets/" + flodername + "/";
#elif UNITY_IPHONE && !UNITY_EDITOR
                System.IO.Path.Combine("file://" + Application.streamingAssetsPath, url);
#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
                System.IO.Path.Combine("file:///" + Application.streamingAssetsPath, url);
#else
                string.Empty;
#endif
#endif
        }

        // Load file
        using (WWW www = new WWW(path)) {
            yield return(www);

            if (string.IsNullOrEmpty(www.error) == false)
            {
                Debug.LogError("File load error.\n" + www.error);
            }
            else
            {
                gifTexList.Clear();

                // Get GIF textures
                if (useCoroutineGetTexture)
                {
                    // use coroutine (avoid lock up but more slow)
                    yield return(StartCoroutine(UniGif.GetTextureListCoroutine(this, www.bytes, (gtList, loop, w, h) => {
                        gifTexList = gtList;
                        FinishedGetTextureList(loop, w, h, autoPlay);
                    }, filterMode, wrapMode, outputDebugLog)));
                }
                else
                {
                    // dont use coroutine (there is a possibility of lock up)
                    int loop, w, h;
                    gifTexList = UniGif.GetTextureList(www.bytes, out loop, out w, out h, filterMode, wrapMode, outputDebugLog);
                    FinishedGetTextureList(loop, w, h, autoPlay);
                }
            }
        }
    }