本文介绍了使用导播API服务的操作步骤及说明。

特别说明

  • 请您区分导播服务与云导播台,导播服务仅提供API服务,您需要自行开发完成前端页面与交互部分,本文适用于导播服务。
  • 云导播台用户请忽略该文档,视频直播控制台提供了导播台产品,可直接使用前端页面进行导播操作。具体操作请参见快速入门

阅读对象

  • 具备java或者PHP开发能力
  • 了解导播产品的基本功能
  • 了解视频直播的基本功能

前提条件

导播操作步骤

  1. 配置导播台
    步骤说明

    导播台实例创建完成后,根据使用需求完成导播台名称、域名、转码、录制、延播、备播素材等配置。

    接口说明
    名称 描述
    SetCasterConfig 设置导播台配置信息
    domainName 将客户提供的域名绑定至导播台实例
    casterTemplate 配置导播台输出分辨率
    liveTemplate 配置导播台直播转码参数
    recordConfig 配置导播台直播录制参数
    示例代码
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    SetCasterConfigRequest setCasterConfigRequest = new SetCasterConfigRequest();
    setCasterConfigRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    setCasterConfigRequest.setCasterName("LIVEPRODUCER_POST-cn-0pp123h****");
    setCasterConfigRequest.setDomainName("LIVEPRODUCER_POST-cn-0pp123h****");
    setCasterConfigRequest.setDelay(10F);
    setCasterConfigRequest.setUrgentMaterialId("LIVEPRODUCER_POST-cn-0pp123h****");
    JSONObject transcodeConfig = new JSONObject();
    JSONArray liveTemplate = new JSONArray();
    liveTemplate.add("lld");
    transcodeConfig.put("LiveTemplate", liveTemplate);
    transcodeConfig.put("CasterTemplate", "lp_ld"); // 导播台分辨率,lp_ld-流畅,lp_sd-标清,lp_hd-高清,lp_ud-超清
    JSONObject recordConfig = new JSONObject();
    JSONArray videoFormat = new JSONArray();
    videoFormat.add(new JSONObject().fluentPut("Format", "flv").fluentPut("OssObjectPrefix", "record/{AppName}/{StreamName}/{StartTime}_{EndTime}").fluentPut("CycleDuration", 15*60));
    videoFormat.add(new JSONObject().fluentPut("Format", "m3u8").fluentPut("OssObjectPrefix", "record/{AppName}/{StreamName}/{StartTime}_{EndTime}").fluentPut("SliceOssObjectPrefix", "record/{AppName}/{StreamName}/{UnixTimestamp}").fluentPut("CycleDuration", 15*60));
    recordConfig.put("VideoFormat", videoFormat);
    recordConfig.put("OssBucket", "ossBucket");
    recordConfig.put("OssEndpoint", "ossEndpoint");
    setCasterConfigRequest.setRecordConfig(recordConfig.toJSONString());
    setCasterConfigRequest.setTranscodeConfig(transcodeConfig.toJSONString());
    setCasterConfigRequest.setCallbackUrl(“http://192.168.1.1“);
    SetCasterConfigResponse response = iAcsClient.getAcsResponse(setCasterConfigRequest);                        
  2. 编辑视频源
    步骤说明

    置用于输出的视频源信息,目前支持直播流及点播素材两种类型。

    接口说明
    名称 描述
    AddCasterVideo 新增视频源
    ModifyCasterVideoResource 修改视频源
    DescribeCasterVideoResources 查询视频源列表
    DeleteCasterVideoResource 删除视频源
    liveStreamUrl 视频源类型为直播流时需提供直播流地址
    materialId 视频源类型为点播素材时需提供点播素材ID,以及循环播放次数(repeatNum)
    locationId 配置视频源名称及视频源位置,作为布局画面的引用编号
    示例代码
     // 新增视频源(AddCasterVideo)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    AddCasterVideoResourceRequest addCasterVideoResourceRequest = new AddCasterVideoResourceRequest();
    addCasterVideoResourceRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    addCasterVideoResourceRequest.setResourceName("LIVEPRODUCER_POST-cn-0pp123h****");
    addCasterVideoResourceRequest.setLocationId("RV01" ); // RV01~RV06为视频源在预监窗口的位置ID,不可重复,布局通过该ID引用视频源
    addCasterVideoResourceRequest.setLiveStreamUrl( null); // 采用点播素材时不输入
    addCasterVideoResourceRequest.setMaterialId("LIVEPRODUCER_POST-cn-0pp123h****");
    addCasterVideoResourceRequest.setRepeatNum( -1); // 视频播放完毕后循环播放
    AddCasterVideoResourceResponse response = iAcsClient.getAcsResponse(addCasterVideoResourceRequest);
    
    // 修改视频源(AddCasterVideo)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    ModifyCasterVideoResourceRequest modifyCasterVideoResourceRequest = new ModifyCasterVideoResourceRequest();
    modifyCasterVideoResourceRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    modifyCasterVideoResourceRequest.setResourceId("LIVEPRODUCER_POST-cn-0pp123h****");
    modifyCasterVideoResourceRequest.setLiveStreamUrl(“rtmp://192.168.1.1“);
    modifyCasterVideoResourceRequest.setResourceName("LIVEPRODUCER_POST-cn-0pp123h****");
    ModifyCasterVideoResourceResponse response = iAcsClient.getAcsResponse(modifyCasterVideoResourceRequest);
    
    // 查询视频源列表(DescribeCasterVideo)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DescribeCasterVideoResourcesRequest describeCasterVideoResourcesRequest = new DescribeCasterVideoResourcesRequest();
    describeCasterVideoResourcesRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    DescribeCasterVideoResourcesResponse response = iAcsClient.getAcsResponse(describeCasterVideoResourcesRequest);
    
    // 删除视频源列表(DescribeCasterVideo)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DeleteCasterVideoResourceRequest deleteCasterVideoResourceRequest = new DeleteCasterVideoResourceRequest();
    deleteCasterVideoResourceRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    deleteCasterVideoResourceRequest.setResourceId("LIVEPRODUCER_POST-cn-0pp123h****");
    DeleteCasterVideoResourceResponse response = iAcsClient.getAcsResponse(deleteCasterVideoResourceRequest);                        
  3. 编辑组件
    步骤说明

    配置用于输出的组件信息,目前支持文字及图片两种类型。

    接口说明
    名称 描述
    AddCasterComponent 新增组件
    ModifyCasterComponent 修改组件
    DescribeCasterComponents 查询组件列表
    DeleteCasterComponent 删除组件
    说明 配置组件内容:
    • 文字组件需提供文字内容、字体比例、颜色等。
    • 图片组件需提供图片素材ID。
    示例代码
    // 新增组件(AddCasterComponent)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    JSONObject componentLayer = new JSONObject();
    componentLayer.put("HeightNormalized", 0.2);
    componentLayer.put("WidthNormalized", 0.2);
    JSONArray positionNormalized = new JSONArray();
    positionNormalized.add("0.3");
    positionNormalized.add("0.3");
    componentLayer.put("PositionNormalized", positionNormalized);
    componentLayer.put("PositionRefer", "topLeft");
    JSONObject textLayerContent = new JSONObject(); // 组件TextLayerContent
    textLayerContent.put("Text", text);
    textLayerContent.put("Color", 0xff0000);
    textLayerContent.put("FontName", "KaiTi");
    textLayerContent.put("SizeNormalized", 0.3F);
    textLayerContent.put("BorderWidthNormalized", 0.3F);
    textLayerContent.put("BorderColor", 0xff0000);
    AddCasterComponentRequest addCasterComponntRequest = new AddCasterComponentRequest(); // 设置组件元素属性
    addCasterComponntRequest.setCasterId(casterId);
    addCasterComponntRequest.setLocationId(locationId);
    addCasterComponntRequest.setComponentName(componentName);
    addCasterComponntRequest.setComponentType("text");
    addCasterComponntRequest.setEffect(effect);
    addCasterComponntRequest.setComponentLayer(componentLayer.toJSONString());
    addCasterComponntRequest.setTextLayerContent(textLayerContent.toJSONString());
    AddCasterComponentResponse response = iAcsClient.getAcsResponse(addCasterComponntRequest);
    
    // 修改组件(ModifyCasterComponent)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    JSONObject componentLayer = new JSONObject();
    componentLayer.put("HeightNormalized", 0.6);
    componentLayer.put("WidthNormalized", 0.6);
    JSONArray positionNormalized = new JSONArray();
    positionNormalized.add("0.3");
    positionNormalized.add("0.3");
    componentLayer.put("PositionNormalized", positionNormalized);
    componentLayer.put("PositionRefer", "topLeft");
    JSONObject textLayerContent = new JSONObject();// 组件TextLayerContent
    textLayerContent.put("Text", text);
    textLayerContent.put("Color", 0xff0000);
    textLayerContent.put("FontName", "KaiTi");
    textLayerContent.put("SizeNormalized", 0.3F);
    textLayerContent.put("BorderWidthNormalized", 0.3F);
    textLayerContent.put("BorderColor", 0xff0000);
    ModifyCasterComponentRequest modifyCasterComponentRequest = new ModifyCasterComponentRequest(); // 设置组件元素属性
    modifyCasterComponentRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    modifyCasterComponentRequest.setComponentId("LIVEPRODUCER_POST-cn-0pp123h****");
    modifyCasterComponentRequest.setComponentName("LIVEPRODUCER_POST-cn-0pp123h****");
    modifyCasterComponentRequest.setComponentType("text"); // 文本类型
    modifyCasterComponentRequest.setEffect("none"); // 无特效
    modifyCasterComponentRequest.setComponentLayer(componentLayer.toJSONString());
    modifyCasterComponentRequest.setTextLayerContent(textLayerContent.toJSONString());
    ModifyCasterComponentResponse response = iAcsClient.getAcsResponse(modifyCasterComponentRequest);
    
    // 查询组件列表(DescribeCasterComponents)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DescribeCasterComponentsRequest describeCasterComponentsRequest= new DescribeCasterComponentsRequest();
    describeCasterComponentsRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    DescribeCasterComponentsResponse response = iAcsClient.getAcsResponse(describeCasterComponentsRequest);
    
    // 删除组件列表(DescribeCasterComponent)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DeleteCasterComponentRequest deleteCasterComponentRequest = new DeleteCasterComponentRequest();
    deleteCasterComponentRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    deleteCasterComponentRequest.setComponentId("LIVEPRODUCER_POST-cn-0pp123h****");
    DeleteCasterComponentResponse response = iAcsClient.getAcsResponse(deleteCasterComponentRequest);                        
  4. 编辑布局
    步骤说明

    配置用于导播输出的画面布局,用户可自定义画面及位置,目前支持最多四个画面。

    接口说明
    名称 描述
    AddCasterLayout 新增布局
    ModifyCasterLayout 修改布局
    DescribeCasterLayouts 查询布局列表
    DeleteCasterLayout 删除视频源
    videoLayer 配置布局样式信息列表
    audioLayer 配置音频信息列表
    blendList 配置视频源位置列表
    mixList 音频位置列表
    示例代码
      // 新增布局(AddCasterLayout)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    JSONObject componentLayer = new JSONObject();
    componentLayer.put("HeightNormalized", 0.6);
    componentLayer.put("WidthNormalized", 0.6);
    JSONArray positionNormalized = new JSONArray();
    positionNormalized.add("0.3");
    positionNormalized.add("0.3");
    componentLayer.put("PositionNormalized", positionNormalized);
    componentLayer.put("PositionRefer", "topLeft");
    JSONObject imageLayerContent = new JSONObject(); // 组件ImageLayerContent
    imageLayerContent.put("MaterialId", "materailId");
    AddCasterComponentRequest addCasterComponntRequest = new AddCasterComponentRequest(); // 设置组件元素属性
    addCasterComponntRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    addCasterComponntRequest.setLocationId("RC01"); // 与组件关联的LocationId
    addCasterComponntRequest.setComponentName("LIVEPRODUCER_POST-cn-0pp123h****");
    addCasterComponntRequest.setComponentType("image"); // 图片类型
    addCasterComponntRequest.setEffect("none"); // 无特效
    addCasterComponntRequest.setComponentLayer(componentLayer.toJSONString());
    addCasterComponntRequest.setImageLayerContent(imageLayerContent.toJSONString());
    AddCasterComponentResponse response = iAcsClient.getAcsResponse(addCasterComponntRequest);
    
    // 修改布局(ModifyCasterLayout)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    ModifyCasterLayoutRequest modifyCasterLayoutRequest = new ModifyCasterLayoutRequest();
    modifyCasterLayoutRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    modifyCasterLayoutRequest.setLayoutId("LIVEPRODUCER_POST-cn-0pp123h****");
    List videoLayersList = new ArrayList(); // 视频layer
    ModifyCasterLayoutRequest.VideoLayer videoLayer1 = new ModifyCasterLayoutRequest.VideoLayer();
    videoLayer1.setHeightNormalized(0.5F);
    videoLayer1.setWidthNormalized(0.5F);
    videoLayer1.setPositionRefer("topLeft");
    videoLayer1.setPositionNormalizeds(Arrays.asList(new Float[]{0F, 0F}));
    videoLayersList.add(videoLayer1);
    ModifyCasterLayoutRequest.VideoLayer videoLayer2 = new ModifyCasterLayoutRequest.VideoLayer();
    videoLayer2.setHeightNormalized(0.5F);
    videoLayer2.setWidthNormalized(0.5F);
    videoLayer2.setPositionRefer("topLeft");
    videoLayer2.setPositionNormalizeds(Arrays.asList(new Float[]{0.5F, 0F}));
    videoLayersList.add(videoLayer2);
    ModifyCasterLayoutRequest.VideoLayer videoLayer3 = new ModifyCasterLayoutRequest.VideoLayer();
    videoLayer3.setHeightNormalized(0.5F);
    videoLayer3.setWidthNormalized(0.5F);
    videoLayer3.setPositionRefer("topLeft");
    videoLayer3.setPositionNormalizeds(Arrays.asList(new Float[]{0.2F, 0.5F}));
    videoLayersList.add(videoLayer3);
    modifyCasterLayoutRequest.setVideoLayers(videoLayersList);
    List audioLayerList = new ArrayList();
    ModifyCasterLayoutRequest.AudioLayer audioLayer1 = new ModifyCasterLayoutRequest.AudioLayer(); // 音频layer
    audioLayer1.setVolumeRate(1F);
    audioLayer1.setValidChannel("all");
    audioLayerList.add(audioLayer1);
    ModifyCasterLayoutRequest.AudioLayer audioLayer2 = new ModifyCasterLayoutRequest.AudioLayer();
    audioLayer2.setVolumeRate(1F);
    audioLayer2.setValidChannel("all");
    audioLayerList.add(audioLayer2);
    ModifyCasterLayoutRequest.AudioLayer audioLayer3 = new ModifyCasterLayoutRequest.AudioLayer();
    audioLayer3.setVolumeRate(1F);
    audioLayer3.setValidChannel("all");
    audioLayerList.add(audioLayer3);
    modifyCasterLayoutRequest.setAudioLayers(audioLayerList);
    modifyCasterLayoutRequest.setBlendLists(Arrays.asList(new String[]{"RV01", "RV02", "RV03"}));
    modifyCasterLayoutRequest.setMixLists(Arrays.asList(new String[]{"RV01", "RV02", "RV03"}));
    ModifyCasterLayoutResponse response = iAcsClient.getAcsResponse(modifyCasterLayoutRequest);
    
    // 查询布局列表(DescribeCasterLayout)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DescribeCasterLayoutsRequest request = new DescribeCasterLayoutsRequest();
    request.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    DescribeCasterLayoutsResponse response = iAcsClient.getAcsResponse(request);
    
    // 删除布局(DescribeCasterLayout)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DeleteCasterLayoutRequest deleteCasterLayoutRequest = new DeleteCasterLayoutRequest();
    deleteCasterLayoutRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    deleteCasterLayoutRequest.setLayoutId("LIVEPRODUCER_POST-cn-0pp123h****");
    DeleteCasterLayoutResponse response = iAcsClient.getAcsResponse(deleteCasterLayoutRequest);                        
  5. 启动导播台
    示例代码

    导播台创建并配置完毕后,即可启动导播台,启动底层音视频处理任务。

    前提条件

    完成导播台配置,包括域名、导播台输出分辨率等。

    接口说明
    名称 描述
    StartCaster 启动导播台
    CasterID 指定需要启动的导播台实例ID
    说明 接口启动成功后返回PVW及PGM场景信息列表,包括场景ID及流信息等,后续操作指定场景时指定场景ID即可。
    示例代码
     // 启动导播台(StartCaster)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    StartCasterSceneRequest startCasterSceneRequest = new StartCasterSceneRequest();
    startCasterSceneRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    startCasterSceneRequest.setSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    StartCasterSceneResponse response = iAcsClient.getAcsResponse(startCasterSceneRequest);                  
  6. 更新场景
    步骤说明

    导播台启动成功后,可将已配置好的布局(组件)生效至指定场景。

    前提条件
    • 完成指定布局(组件)的编辑
    • 指定场景存在并启动
    接口说明
    名称 描述
    UpdateCasterSceneConfig 更新场景配置
    DeleteCasterSceneConfig 删除场景配置
    CasterID 指定导播台实例ID
    SceneID 指定场景ID
    LayoutID 指定布局ID,若未指定则默认无变更。
    示例代码
    // 更新场景配置(UpdateCasterSceneConfig)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    UpdateCasterSceneConfigRequest updateCasterSceneConfigRequest = new UpdateCasterSceneConfigRequest();
    updateCasterSceneConfigRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    updateCasterSceneConfigRequest.setLayoutId("LIVEPRODUCER_POST-cn-0pp123h****");
    updateCasterSceneConfigRequest.setSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    updateCasterSceneConfigRequest.setComponentIds(componentList);
    UpdateCasterSceneConfigResponse response = iAcsClient.getAcsResponse(updateCasterSceneConfigRequest);
    
    // 删除场景配置(DeleteCasterSceneConfig)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    DeleteCasterSceneConfigRequest deleteCasterSceneConfigRequest = new DeleteCasterSceneConfigRequest();
    deleteCasterSceneConfigRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    deleteCasterSceneConfigRequest.setLayoutId("LIVEPRODUCER_POST-cn-0pp123h****");
    deleteCasterSceneConfigRequest.setType("Component") // 清除场景中的组件配置
    DeleteCasterSceneConfigResponse response = iAcsClient.getAcsResponse(deleteCasterSceneConfigRequest);                       
  7. 预监(PVW)切换到节目(PGM)
    步骤说明

    导播台启动成功后,可将PVW的布局配置信息设置到PGM场景。

    前提条件
    • PVW场景存在并启动
    • PGM场景存在并启动
    接口说明
    名称 描述
    CopyCasterSceneConfig 更新场景配置
    CasterID 指定导播台实例ID
    FromSceneID 指定PVW场景ID
    ToSceneID 指定PGM场景ID
    示例代码
    // 场景切换(CopyCasterSceneConfig)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    CopyCasterSceneConfigRequest copyCasterSceneConfigRequest = new CopyCasterSceneConfigRequest();
    copyCasterSceneConfigRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    copyCasterSceneConfigRequest.setFromSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    copyCasterSceneConfigRequest.setToSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    CopyCasterSceneConfigResponse response = iAcsClient.getAcsResponse(copyCasterSceneConfigRequest);                 
  8. 预监开启、关闭
    步骤说明

    导播台启动成功后,可通过预监开启、关闭服务控制PVW场景,关闭PVW场景后布局及视频源变动可直接生效至PGM场景。

    前提条件

    PVW场景存在。

    接口说明
    名称 描述
    StartCasterScene 预监开启
    StopCasterScene 预监关闭
    CasterID 指定导播台实例ID
    SceneID 指定PVW场景ID
    示例代码
     // 预监开启(StartCasterScene)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    StartCasterSceneRequest startCasterSceneRequest = new StartCasterSceneRequest();
    startCasterSceneRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    startCasterSceneRequest.setSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    StartCasterSceneResponse response = iAcsClient.getAcsResponse(startCasterSceneRequest);
    
    // 预监关闭(StopCasterScene)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    StopCasterSceneRequest stopCasterSceneRequest = new StopCasterSceneRequest();
    stopCasterSceneRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    stopCasterSceneRequest.setSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    StopCasterSceneResponse response = iAcsClient.getAcsResponse(stopCasterSceneRequest);                        
  9. 备播切换、切回
    步骤说明

    导播台启动成功后,可通过备播切换服务将PGM场景切换至备播画面,若需要切回直播场景可通过回切直播服务完成。

    前提条件
    • 导播台实例已启动
    • 完成备播素材ID配置
    接口说明
    名称 描述
    EffectCasterUrgent 备播紧急生效
    SetCasterSceneConfig 切回直播
    CasterID 指定导播台实例ID
    SceneID 指定PGM场景实例ID
    示例代码
     // 切换备播(StartCasterScene)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    EffectCasterUrgentRequest effectCasterUrgentRequest = new EffectCasterUrgentRequest();
    effectCasterUrgentRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    effectCasterUrgentRequest.setSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    EffectCasterUrgentResponse response = iAcsClient.getAcsResponse(effectCasterUrgentRequest);
    
    // 切回直播(SetCasterSceneConfig)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    SetCasterSceneConfigRequest setCasterSceneConfigRequest = new SetCasterSceneConfigRequest();
    setCasterSceneConfigRequest.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    setCasterSceneConfigRequest.setSceneId("LIVEPRODUCER_POST-cn-0pp123h****");
    setCasterSceneConfigRequest.setLayoutId(null); // 若需要退出备播播放传null,若需要转到指定布局输入layoutId即可
    SetCasterSceneConfigResponse response = iAcsClient.getAcsResponse(setCasterSceneConfigRequest);                
  10. 停止导播台
    步骤说明

    导播台启动成功后,可通过停止导播台服务停止指定导播台及底层音视频任务。

    前提条件

    导播台实例已启动。

    接口说明
    名称 描述
    StopCaster 停止导播台
    CasterID 指定导播台实例ID
    示例代码
    // 停止导播台(StopCaster)
    IAcsClient iAcsClient = new DefaultAcsClient(DefaultProfile.getProfile("regionId", "accessKeyId", "secret"));
    StopCasterRequest request = new StopCasterRequest();
    request.setCasterId("LIVEPRODUCER_POST-cn-0pp123h****");
    StopCasterResponse response = iAcsClient.getAcsResponse(request);