# StartLiveEvent

public delegate void StartLiveEvent(bool isAudioPermissionGranted);

1.回调描述

开启直播回调:启动音视频的采集。

2.参数

参数 类型 含义
isAudioPermissionGranted bool 是否已经获得了麦克风授权

3.示例代码

mJetPackEngine.livePush.OnStartLiveEvent += OnStartLive;

public void OnStartLive(bool isAudioPermissionGranted)
    {
        _wxgameliveObject = new GameObject(_gameObjectName);
        _wxgameliveObject.AddComponent<WXGameLiveEvent>();
        
        updateAllDebugPanelItemWithChangeLiveState(true);
        
        int videoBitrate = GetVideoBitrate(mDdBitrate.value);
        int videoResolution = GetResolution(mDdResolution.value);
        int sampleRate = GetSampleRate(mDdSampleRate.value);
        float mixFactor = GetMixFactor(mDdMixFactor.value);
        
        Debug.Log("Video resolution: " + videoResolution + " video bitrate:" + videoBitrate + "  video Fps: " + mVideoFps + " gop: " + mGop + "  audio sampleRate: " + sampleRate + " mixFactor: " + mixFactor);
         WXGameJetPack.GetEngine().livePush.SetMediaFormat(videoResolution, videoBitrate, mVideoFps, mGop, sampleRate, mixFactor);

        mAudioPermissionGranted = isAudioPermissionGranted;
        if (isAudioPermissionGranted)
        {
            ...
        }
        else
        {
            Debug.Log("Audio Record Permission is not granted!");
            // TODO:
            // 引导用户去同意麦克风权限
        }

    }