获取频道观看条件信息

请求地址

http://api.polyv.net/live/v2/channelSetting/{channelId}/watchAuth

接口说明

1、获取频道观看条件信息
2、接口URL中的{channelId}为 频道ID
3、接口支持https协议

请求方式

GET

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前13位毫秒级时间戳,3分钟内有效
userId string 直播账号ID
sign string 签名,为32位大写的MD5值

响应成功JSON示例

{
  1. 无限制: {
    code: 200, 
    status: "success",
    message: "",
    data: {
    authType: "none",
    channelId: 110895
  }
  }
  authType:为观看条件的类型
  2. 验证码观看: {
    code: 200,
    status: "success",
    message: "",
    data: {
    authType: "code",    //授权类型,此处为验证码
    channelId: 110895,
    authTips: "提示文字",   //出现的提示文字
    authCode: "验证码",     //验证码内容
    qcodeEnabled: "Y",      //开启二维码
    qcodeImg: "",           //二维码图片
    qcodeTips: "",          //提示扫描二维码的文字
    shareViewable: "N"     //是否分享可观看
  }
  }
  3. 付费观看:{
    code: 200,
    status: "success",
    message: "",
    data: {
      authType: "pay",
      channelId: 101385,
      authTips: "提示文字",
      price: "909.00",       //付费价格
      validTimeEnabled: "Y",   //是否开启截止时间
      watchEndTime: 1489823715000, //观看截止时间
      shareViewable: "Y",       //是否分享可观看
      mixPayPhoneEnabled: "N",  //是否同时开启白名单
      phoneWhties:[
        {           //白名单具体信息
        channelId: 101385,
        phone: "13712345678",
        userId: "edvf2fpec9",
        name: "你好",
        isVip: "N",
        createdTime: 1489371356000,
        lastModified: 1489371356000
      },
      {
        channelId: 101385,
        phone: "测试测试",
        userId: "edvf2fpec9",
        name: "测试测试",
        isVip: "N",
        createdTime: 1489371356000,
        lastModified: 1489371356000
      },
      {
        channelId: 101385,
        phone: "13212345678",
        userId: "edvf2fpec9",
        name: "马",
        isVip: "N",
        createdTime: 1489371356000,
        lastModified: 1489371356000
      }
      ]
    }
  }
  4. 白名单观看:
  {
    code: 200,
    status: "success",
    message: "",
    data: {
      authType: "phone",
      channelId: 101385,
      authTips: "欢迎观看本直播",
      whitelistEnabled: "Y",      //是否开启白名单
      phoneWhties: [ {            //phoneWhties:白名单的相关信息
      {
        channelId: 101385,
        phone: "你好",
        userId: "edvf2fpec9",
        name: "你好",
        isVip: "N",
        createdTime: 1489371356000,
        lastModified: 1489371356000
      },
      {
        channelId: 101385,
        phone: "测试测试",
        userId: "edvf2fpec9",
        name: "测试测试",
        isVip: "N",
        createdTime: 1489371356000,
        lastModified: 1489371356000
      },
      {
        channelId: 101385,
        phone: "hello",
        userId: "edvf2fpec9",
        name: "hello",
        isVip: "N",
        createdTime: 1489371356000,
        lastModified: 1489371356000
      }
      ],
      shareViewable: "Y"
    }
  }
  5. 自定义授权观看:{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
    "authType": "custom",
    "channelId": 110895,
    "customUri": "http:www.test.demo.php",  //用户自定义地址
    "customKey": "SEdkpodDck"               //频道号secretkey
  }
  }
  6. 登记观看:{
    code: 200,
    status: "success",
    message: "",
    data: {
    authType: "info",
    channelId: 101385,
    infoFieldEnabled1: "Y",              //是否启用该字段
    infoFieldName1: "字段1",             //字段名称
    infoFieldPlaceholder1: "字段1字段1字段1字段1", //字段描述
    infoFieldType1: "text",              //字段类型
    infoFieldOption1: "",                //下拉选择项,如为字段类型为text和number时,此字段为空
    infoFieldEnabled2: "Y",
    infoFieldName2: "字段2",
    infoFieldPlaceholder2: "字段2字段2字段2字段2",
    infoFieldType2: "number",
    infoFieldOption2: "",
    infoFieldEnabled3: "Y",
    infoFieldName3: "字段3",
    infoFieldPlaceholder3: "字段3字段3字段3字段3",
    infoFieldType3: "option",
    infoFieldOption3: "1,2,3,4,5",
    infoFieldEnabled4: "N",
    infoFieldName4: "",
    infoFieldPlaceholder4: "",
    infoFieldType4: "",
    infoFieldOption4: "",
    infoFieldEnabled5: "",
    infoFieldName5: null,
    infoFieldPlaceholder5: "",
    infoFieldType5: "",
    infoFieldOption5: "",
    shareViewable: "N"
  }
  }
  7. 外部授权观看:{
    code: 200,
    status: "success",
    message: "",
    data: {
    authType: "external",
    channelId: 125527,
    "externalUri": "http://demo.polyv.net/chenwb/live-validate2.php",  //用户自定义地址
    "externalKey": "L0EjokKI4O"               //频道号secretkey
  }
  }

响应异常JSON示例

{
  code: 400,
  status: "error",
  message: "invalid timestamp.",
  data: ""
}

PHP请求示例

<?php

//引用config.php
include 'config.php';

//接口需要的参数(非sign)赋值
$channelId = "101385";
$userId = "XXXXXXXXXX";

$params = array(
    'appId'=>$appId,
    'userId'=>$userId,
    'timestamp'=>$timestamp
  );

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

//接口请求url
$url = "http://api.live.polyv.net/v2/channelSetting/".$channelId."/watchAuth?appId=".$appId."&timestamp=".$timestamp."&userId=".$userId."&sign=".$sign;
//输出接口请求结果
echo file_get_contents($url);

?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...