Esempio n. 1
0
        /// <summary>
        /// 启动录制模块 (Start the recorder module)
        /// </summary>
        public static void StartRecorder()
        {
            if (GlassLiveImpl.CanStart())
            {
                beginHanlder.enabled = true;
                endHanlder.enabled   = true;

                GlassLiveImpl.InitRenderTexture();
                GlassLiveImpl.Start();
            }
        }
Esempio n. 2
0
 void OnRenderImage(RenderTexture src, RenderTexture dest)
 {
     GlassLiveImpl.AddCameraRecord(src);
         #if (UNITY_5_6_OR_NEWER)
     GlassLiveImpl.OnPostRender();
         #else
     if (!ShareRECImpl.IsRecordGUILayer())
     {
         ShareRECImpl.OnPostRender();
     }
         #endif
 }
Esempio n. 3
0
        void Awake()
        {
            try {
                GlassLiveImpl.Init(AppKey, AppSecret, gameObject.name, (int)MaxFrameSize);
                GlassLiveImpl.SetVideoQuality((int)VideoQuality);
                GlassLiveImpl.SetForceSoftwareEncoding(SoftwareVideoEncoder, SoftwareAudioEncoder);
                GlassLiveImpl.SetCacheFolder(CacheFolder);
                GlassLiveImpl.SetMinDuration(MinDuration);

                if (RecordAudioFromMic)
                {
                    GlassLiveImpl.SetRecordAudioFromMic();
                }
                        #if (!UNITY_5_6_OR_NEWER)
                if (RecordGUILayer)
                {
                    ShareRECImpl.SetRecordGUILayer();
                }
                        #endif
            } catch (Exception e) {}
            InitializeFrontMostCamera();
            InitializeBackMostCamera();
        }
Esempio n. 4
0
 void OnPreRender()
 {
     GlassLiveImpl.OnPreRender();
 }
Esempio n. 5
0
 /// <summary>
 /// 将录音得到的 数据添加到录制的视频数据里 Offers the sample.
 /// </summary>
 public static void OfferSample(byte[] sample, int offset, int len)
 {
     GlassLiveImpl.OfferSample(sample, offset, len);
 }
Esempio n. 6
0
 /// <summary>
 /// 不使用默认的record进行录音,使用自定义的录音方式录音  Prepares the sound copying.
 /// 注意,需要再 执行 StartRecorder()方法之前调用,否则无效
 /// </summary>
 public static void PrepareSoundCopying(int channelCount, int sampleRate, int maxBufferSizeInBytes)
 {
     GlassLiveImpl.PrepareSoundCopying(channelCount, sampleRate, maxBufferSizeInBytes);
 }
Esempio n. 7
0
 /// <summary>
 /// 添加要录屏的cmaera(add record camera.)
 /// </summary>
 public static void addCameraRecord(RenderTexture src)
 {
     GlassLiveImpl.AddCameraRecord(src);
 }
Esempio n. 8
0
 /// <summary>
 /// 通过缓存的视频ID获取本地路径(Gets the local video path by its ID.)
 /// </summary>
 public static string GetLocalVideoPath(long videoId)
 {
     return(GlassLiveImpl.GetLocalVideoPath(videoId));
 }
Esempio n. 9
0
 /// <summary>
 /// 停止录制模块 (Stop the recorder module)
 /// </summary>
 public static void StopRecorder()
 {
     GlassLiveImpl.Stop();
 }
Esempio n. 10
0
 /// <summary>
 /// 恢复录制(Resumes the recorder module)
 /// </summary>
 public static void ResumeRecorder()
 {
     GlassLiveImpl.Resume();
 }
Esempio n. 11
0
 /// <summary>
 /// 暂停录制模块(Pauses the recorder module)
 /// </summary>
 public static void PauseRecorder()
 {
     GlassLiveImpl.Pause();
 }
Esempio n. 12
0
        // =======================================

        /// <summary>
        /// 判断ShareRec是否支持当前的设备(Determines whether ShareRec is available for the current device.)
        /// </summary>
        public static bool IsAvailable()
        {
            return(GlassLiveImpl.IsAvailable());
        }
Esempio n. 13
0
        // =======================================


        /// <summary>
        /// 添加视频的自定义属性(Adds the custom attributes of the video.)
        /// </summary>
        public static void AddCustomAttr(string key, string value)
        {
            GlassLiveImpl.AddCustomAttr(key, value);
        }
Esempio n. 14
0
 public static void SetLiveURL(string url)
 {
     GlassLiveImpl.SetCacheFolder(url);
 }
Esempio n. 15
0
 /// <summary>
 /// 启用GLES30
 /// </summary>
 public static void UseGLES30API()
 {
     GlassLiveImpl.useGLES30API();
 }
Esempio n. 16
0
        private void onStateChange(string action)
        {
            int iAction = -1;

            if (!Int32.TryParse(action, out iAction))
            {
                return;
            }

            switch (iAction)
            {
            case STATE_STARTING: {
                if (OnRecorderStartingHandler != null)
                {
                    OnRecorderStartingHandler();
                }
            } break;

            case STATE_STARTED: {
                if (curAction == STATE_RESUMING)
                {
                    if (OnRecorderResumedHandler != null)
                    {
                        OnRecorderResumedHandler();
                    }
                }
                else if (OnRecorderStartedHandler != null)
                {
                    OnRecorderStartedHandler();
                }
            } break;

            case STATE_PAUSING: {
                if (OnRecorderPausingHandler != null)
                {
                    OnRecorderPausingHandler();
                }
            } break;

            case STATE_PAUSED: {
                if (OnRecorderPausedHandler != null)
                {
                    OnRecorderPausedHandler();
                }
            } break;

            case STATE_RESUMING: {
                if (OnRecorderResumingHandler != null)
                {
                    OnRecorderResumingHandler();
                }
            } break;

            case STATE_STOPPING: {
                if (OnRecorderStoppingHandler != null)
                {
                    OnRecorderStoppingHandler();
                }
            } break;

            case STATE_STOPPED: {
                beginHanlder.enabled = false;
                endHanlder.enabled   = false;
                GlassLiveImpl.ReleaseRenderTexture();
                if (OnRecorderStoppedHandler != null)
                {
                    OnRecorderStoppedHandler();
                }
            } break;

            case STATE_LIVE_STRT:
                break;

            case STATE_LIVE_STOP:
                break;
            }

            curAction = iAction;
        }