URL Custom Marquee
Backend Settings
Live streaming backend --> Select channel --> Content Protection (Anti-Screen Recording) Marquee --> In the marquee type, click to select "URL Custom Settings", then fill in the URL. For example: http://www.mywebsite.com/pmd.php
Player Parameter Retrieval
The player will append various parameters when requesting the JSON URL. http://www.mywebsite.com/pmd.php?vid=106385&uid=edvf2fpec9&code=aa&t=149008564655235879
Here, code=aa means aa is the value set for the code parameter (to ensure browser compatibility, if using Chinese, please base64 safe encode the value of code before sending).
Backend JSON Response
pmd.php Dynamic JSON Generation Reference
Note:
If the API returns Chinese content, please set the encoding to UTF-8.
The API response must include the Content-type header.
<?php
$username= "跑马灯测试";
$vid = $_GET["vid"];
$uid = $_GET["uid"];
$t = $_GET["t"];
$code = $_GET["code"];
$callback = isset($_GET["callback"])?$_GET["callback"]:null; //未提交callback时则设为空
$msg='播放错误(测试)';
$fontSize=50;
$fontColor='0xFFFF00';
$speed=50;
$filter='on';
$setting=3;
$alpha=0.9;
$filterAlpha=0.9;
$filterColor='0xFF0000';
$blurX=2;
$blurY=2;
$interval=2;
$lifeTime=5;
$tweenTime=5;
$strength=100;
$show='on';
$str="vid=".$vid."&uid=".$uid."&username=".$username."&code=".$code."&t=".$t."&msg=".$msg."&fontSize=".$fontSize."&fontColor=".$fontColor."&speed=".$speed."&filter=".$filter."&setting=".$setting."&alpha=".$alpha."&filterAlpha=".$filterAlpha."&filterColor=".$filterColor."&blurX=".$blurX."&blurY=".$blurY."&interval=".$interval."&lifeTime=".$lifeTime."&tweenTime=".$tweenTime."&strength=".$strength."&show=".$show;
$sign=md5($str); //加密规则,md5加密,
$array = Array("show"=>$show,"sign"=>$sign,"username"=>$username,"msg"=>$msg,"fontSize"=>$fontSize,"fontColor"=>$fontColor,"speed"=>$speed,"filter"=>$filter,"setting"=>$setting,"alpha"=>$alpha,"filterAlpha"=>$filterAlpha,"filterColor"=>$filterColor,"blurX"=>$blurX,"blurY"=>$blurY,"interval"=>$interval,"lifeTime"=>$lifeTime,"tweenTime"=>$tweenTime,"strength"=>$strength);
$validateJson = json_encode($array);
if($callback != ''){
echo $callback."(".$validateJson.")";
} else{
echo $validateJson;
}
?>
All Parameters:
| No. | Parameter | Required | Type | Description | Optional Values | Default Value |
|---|---|---|---|---|---|---|
| 1 | username | true | String | Content displayed by the marquee | ||
| 2 | sign | true | String | 32-bit lowercase value calculated via MD5 encryption algorithm | ||
| 3 | msg | true | String | Custom playback error message | ||
| 4 | fontSize | true | Integer | Marquee text font size | 30 | |
| 5 | fontColor | true | String | Marquee text font color | A number containing three 8-bit RGB color components; e.g., 0x000000 is black | 0x000000 (black) |
| 6 | speed | true | Integer (unit: seconds/10) | Time required for marquee text to move a specified number of pixels | 200 | |
| 7 | filter | true | String | Whether to apply stroke | "on": stroke, "off": no stroke | off |
| 8 | setting | true | Integer | Marquee style | 1: Scroll continuously from right to left 2: Flash at random positions within the screen 3: Scroll continuously from right to left with fade in/out 4: Scroll within the top and bottom 15% of the video area 5: Randomly flash text within the top and bottom 15% of the video area 6: Enhanced version of style 1, better encryption effect, recommended 7: Enhanced version of style 2, better encryption effect, recommended |
1 |
| 9 | alpha | true | Float | Marquee text transparency | Range: 0~1 | 1 |
| 10 | filterAlpha | true | Float | Marquee stroke transparency | Range: 0~1 | 1 |
| 11 | filterColor | true | String | Marquee stroke color | A number containing three 8-bit RGB color components; e.g., 0x000000 is black | 0x000000 (black) |
| 12 | blurX | true | Integer | Horizontal blur amount for marquee stroke | Range: 0~255 | 2 |
| 13 | blurY | true | Integer | Vertical blur amount for marquee stroke | Range: 0~255 | 2 |
| 14 | interval | true | Integer (unit: seconds) | Interval time for hiding marquee text | 5 | |
| 15 | lifeTime | true | Integer (unit: seconds) | Display time for marquee text | 3 | |
| 16 | tweenTime | true | Integer (unit: seconds) | Fade in/out time for marquee text | 1 | |
| 17 | strength | true | Integer | Marquee stroke strength | Range: 0~255 | 4 |
| 18 | show | true | String | Whether to display the marquee, displayed by default | on |
ps: For numeric parameters above, ensure non-zero values are passed.
Sign Calculation Rule Parameters
Concatenate the values of the following parameters into a string and perform MD5 calculation. The signature requires all the following parameters to be concatenated, even if a value is not set.
$str="vid=".$vid."&uid=".$uid."&username=".$username."&code=".$code."&t=".$t."&msg=".$msg."&fontSize=".$fontSize."&fontColor=".$fontColor."&speed=".$speed."&filter=".$filter."&setting=".$setting."&alpha=".$alpha."&filterAlpha=".$filterAlpha."&filterColor=".$filterColor."&blurX=".$blurX."&blurY=".$blurY."&interval=".$interval."&lifeTime=".$lifeTime."&tweenTime=".$tweenTime."&strength=".$strength."&show=".$show;
$sign=md5($str);
Cross-Origin
crossdomain.xml
A crossdomain.xml file must be placed under the domain where the JSON URL is saved for Flash.
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
Access-Control-Allow-Origin
The H5 player has cross-origin issues. This can be resolved by adding the following configuration in PHP.
header("Access-Control-Allow-Origin: *");
Note
Polyv offers more attentive and professional services. If you only need simple marquee usage, please click Video Marquee – The New Content Protection Tool and follow the steps to configure.
