public void startDecoding()
 {
     if (decoderState == NativeClass.DecoderState.INITIALIZED)
     {
         if (!NativeClass.nativeStartDecoding(decoderID))
         {
             print(LOG_TAG + " Decoding not start.");
             return;
         }
         decoderState         = NativeClass.DecoderState.BUFFERING;
         globalStartTime      = curRealTime;
         hangTime             = curRealTime - globalStartTime;
         isVideoReadyToReplay = isAudioReadyToReplay = false;
         if (isAudioEnabled && !isAllAudioChEnabled)
         {
             StartCoroutine("audioPlay");
             backgroundWorker = new BackgroundWorker();
             backgroundWorker.WorkerSupportsCancellation = true;
             backgroundWorker.DoWork += pullAudioData;
             backgroundWorker.RunWorkerAsync();
         }
     }
 }
        public static void loadVideoThumb(GameObject obj, string filePath, float time)
        {
            if (!File.Exists(filePath))
            {
                print(LOG_TAG + " File not found!");
                return;
            }
            var decID     = -1;
            var width     = 0;
            var height    = 0;
            var totalTime = 0.0f;

            NativeClass.nativeCreateDecoder(filePath, ref decID);
            NativeClass.nativeGetVideoFormat(decID, ref width, ref height, ref totalTime);
            if (!NativeClass.nativeStartDecoding(decID))
            {
                print(LOG_TAG + " Decoding not start.");
                return;
            }
            var thumbY   = new Texture2D(width, height, TextureFormat.Alpha8, false);
            var thumbU   = new Texture2D(width / 2, height / 2, TextureFormat.Alpha8, false);
            var thumbV   = new Texture2D(width / 2, height / 2, TextureFormat.Alpha8, false);
            var thumbMat = getMaterial(obj);

            if (thumbMat == null)
            {
                print(LOG_TAG + " Target has no MeshRenderer.");
                NativeClass.nativeDestroyDecoder(decID);
                return;
            }
            thumbMat.SetTexture("_YTex", thumbY);
            thumbMat.SetTexture("_UTex", thumbU);
            thumbMat.SetTexture("_VTex", thumbV);
            NativeClass.nativeLoadThumbnail(decID, time, thumbY.GetNativeTexturePtr(), thumbU.GetNativeTexturePtr(), thumbV.GetNativeTexturePtr());
            NativeClass.nativeDestroyDecoder(decID);
        }