Polyv Help Center

Help Center

Set Player Logo

Updated: 2024-12-16 19:20:19

API Description

1、修改播放器logo图片
2、接口URL中的{channelId}为 频道ID
3、接口支持https协议

API URL

http://api.polyv.net/live/v2/channels/{channelId}/update

Request Method

POST

Supported Format

JSON

Request Limit

TRUE

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live system
timestamp Yes string Current 13-digit millisecond timestamp, valid within 3 minutes
logoImage Yes string Logo image URL, recommended size: rectangle 140x50 or square 50x50
logoOpacity Yes string Logo opacity, value range (0,1], i.e., greater than 0 and less than or equal to 1
logoPosition Yes string Logo position, values: top-left (tl), top-right (tr), bottom-left (bl), bottom-right (br)
logoHref No string Click-through link for the logo image
sign Yes string Signature, 32-character uppercase MD5 value

Successful Response JSON Example:

{
  code: 200,
  status: "success",
  message: "",
  data: true
}

Error Response JSON Example:

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

Field Description

Parameter Description
code Response status code
status Response status
message Error message
data Error data

PHP Request Example

<?php

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

//接口需要的参数(非sign)赋值
$channelId = "127075";
$logoImage = "http://demo.ipolyv.cn/wfy/live/logo.jpg"; //播放器封面图
$logoOpacity = "0.5"; //透明度,取值范围为(0,1]
$logoPosition = "tr"; //图片位置,取值为左上(tl)、右上(tr)、左下(bl)、右下(br)
$logoHref ="http://www.polyv.net"; //图片点击跳转链接

$params = array(
    'appId'=>$appId,
    'logoImage'=>$logoImage,
    'logoOpacity'=>$logoOpacity,
    'logoPosition'=>$logoPosition,
    'logoHref'=>$logoHref,
    'timestamp'=>$timestamp
  );

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

//接口请求url
$url = "http://api.live.polyv.net/v2/channels/$channelId/update?appId=$appId&timestamp=$timestamp&logoHref=$logoHref&logoImage=$logoImage&logoOpacity=$logoOpacity&logoPosition=$logoPosition&sign=$sign";
$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;

?>

Signature Rules (View config.php file code)

Signature Generation Rules

联系客服,在线咨询
在线咨询