/// <summary> /// 启动录制模块 (Start the recorder module) /// </summary> public static void StartRecorder() { if (GlassLiveImpl.CanStart()) { beginHanlder.enabled = true; endHanlder.enabled = true; GlassLiveImpl.InitRenderTexture(); GlassLiveImpl.Start(); } }
void OnRenderImage(RenderTexture src, RenderTexture dest) { GlassLiveImpl.AddCameraRecord(src); #if (UNITY_5_6_OR_NEWER) GlassLiveImpl.OnPostRender(); #else if (!ShareRECImpl.IsRecordGUILayer()) { ShareRECImpl.OnPostRender(); } #endif }
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(); }
void OnPreRender() { GlassLiveImpl.OnPreRender(); }
/// <summary> /// 将录音得到的 数据添加到录制的视频数据里 Offers the sample. /// </summary> public static void OfferSample(byte[] sample, int offset, int len) { GlassLiveImpl.OfferSample(sample, offset, len); }
/// <summary> /// 不使用默认的record进行录音,使用自定义的录音方式录音 Prepares the sound copying. /// 注意,需要再 执行 StartRecorder()方法之前调用,否则无效 /// </summary> public static void PrepareSoundCopying(int channelCount, int sampleRate, int maxBufferSizeInBytes) { GlassLiveImpl.PrepareSoundCopying(channelCount, sampleRate, maxBufferSizeInBytes); }
/// <summary> /// 添加要录屏的cmaera(add record camera.) /// </summary> public static void addCameraRecord(RenderTexture src) { GlassLiveImpl.AddCameraRecord(src); }
/// <summary> /// 通过缓存的视频ID获取本地路径(Gets the local video path by its ID.) /// </summary> public static string GetLocalVideoPath(long videoId) { return(GlassLiveImpl.GetLocalVideoPath(videoId)); }
/// <summary> /// 停止录制模块 (Stop the recorder module) /// </summary> public static void StopRecorder() { GlassLiveImpl.Stop(); }
/// <summary> /// 恢复录制(Resumes the recorder module) /// </summary> public static void ResumeRecorder() { GlassLiveImpl.Resume(); }
/// <summary> /// 暂停录制模块(Pauses the recorder module) /// </summary> public static void PauseRecorder() { GlassLiveImpl.Pause(); }
// ======================================= /// <summary> /// 判断ShareRec是否支持当前的设备(Determines whether ShareRec is available for the current device.) /// </summary> public static bool IsAvailable() { return(GlassLiveImpl.IsAvailable()); }
// ======================================= /// <summary> /// 添加视频的自定义属性(Adds the custom attributes of the video.) /// </summary> public static void AddCustomAttr(string key, string value) { GlassLiveImpl.AddCustomAttr(key, value); }
public static void SetLiveURL(string url) { GlassLiveImpl.SetCacheFolder(url); }
/// <summary> /// 启用GLES30 /// </summary> public static void UseGLES30API() { GlassLiveImpl.useGLES30API(); }
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; }