To enable CSS porn detection, you need to enable CSS screencapture first either in the CSS console or through API. This document describes how to implement CSS porn detection through API.
As the CSS porn detection feature is based on the CSS screencapture feature, you have to enable CSS screencapture first before you can enable CSS porn detection. The steps are as follows:
Call CreateLiveSnapshotTemplate and set PornFlag
to 1 to create a porn detection-enabled CSS screencapture template.
Call CreateLiveSnapshotRule to create a porn detection-enabled CSS screencapture rule and bind the CSS screencapture template ID created in step 1 to the AppID
, DomainName
, AppName
, and StreamName
of the live stream that needs to undergo porn detection.
After a porn detection-enabled CSS screencapture rule is created, the porn detection feature will be automatically enabled for new live streams. If you want to enable porn detection for a live stream that is in progress, you need to stop and restart the stream for the feature to take effect.
After CSS porn detection is enabled, you can configure the registered callback domain name in the porn detection callback template to have the CSS backend call back the porn detection result.
Note:
By default, only suspicious results will be called back.
Call CreateLiveCallbackTemplate and set PornCensorshipNotifyUrl
to your domain name to create an CSS porn detection callback template.
Call CreateLiveCallbackRule to create a porn detection-enabled CSS screencapture rule and bind the CSS screencapture template ID created in the previous step to the AppId
, DomainName
, and AppName
of the live stream that needs to undergo porn detection.
The CSS backend sends the porn detection result to your registered domain name through an HTTP POST request where the result is stored in the HTTP body in JSON format. You can determine whether the live stream is pornographic by the type
field alone.
Note:
We recommend you use the
type
of an image to determine whether it is pornographic. As the detection system cannot achieve 100% accuracy, there may be false positives or false negatives, and human confirmation is recommended.
Parameter | Required | Data Type | Description |
---|---|---|---|
tid | Yes | Number | Alert policy ID. Video content alert: 20001 |
streamId | No | String | Stream name |
channelId | No | string | Channel ID |
img | Yes | string | Link to alerted image |
type | Yes | Array | Image type. 0: normal, 1–5: non-compliant, 6–9: others |
confidence | Yes | Number | Confidence of detected pornographic information in the range of 0–100, which is an overall score of normalScore , hotScore , and pornScore |
normalScore | Yes | Number | Normal score of image |
hotScore | Yes | Number | Sexual score of image |
pornScore | Yes | Number | Pornographic score of image |
level | No | Number | Image level |
ocrMsg | No | string | OCR information of image (if any) |
screenshotTime | Yes | Number | Screencaptured time |
sendTime | Yes | Number | Request sent time (UNIX timestamp) |
abductionRisk | No | Array | An array containing the AbductionRisk structure |
gameDetails | No | Object | Game details |
similarScore | No | Number | Similarity score of image |
stream_param | No | String | Push parameter |
app | No | String | Push domain name |
appid | No | Number | Business ID |
appname | No | String | Push path |
Parameter | **Required ** | Data Type | Description |
---|---|---|---|
level | Yes | Number | Risk level in the range of 0–4. The larger the number, the higher the risk. 3 and 4 indicate maliciousness and should be handled |
type | Yes | Number | Risk type. 20002: porn |
Parameter | Required | Type | Description |
---|---|---|---|
gender | No | Number | Gender [0 (female)–100 (male)] |
age | No | Number | Age |
expression | No | Number | Expression [0 (normal)–50 (smile)–100 (laugh)] |
beauty | No | Number | Charm [0–100] |
x | No | Number | x coordinate of the top-left corner of face frame |
y | No | Number | y coordinate of the top-left corner of face frame |
width | No | Number | Face frame width |
height | No | Number | Face frame height |
Parameter | Required | Type | Description |
---|---|---|---|
battlegrounds | No | Object | PUBG information |
gameList | No | Array | Game list |
Parameter | Required | Type | Description |
---|---|---|---|
name | No | String | Game name |
confidence | No | Number | Probability |
HTTP Body:
{
"ocrMsg":"",
"type":[2],
"confidence":0,
"normalScore":2,
"hotScore":97,
"pornScore":0,
"screenshotTime":1575513174,
"level":0,
"img":"http://test-10000.cos.ap-shanghai.myqcloud.com/2019-12-05/teststream-screenshot-10-32-54-960x540.jpg",
"abductionRisk":[ ],
"sendTime":1575513176,
"similarScore":0,
"tid":20001,
"streamId":"teststream",
"channelId":"teststream",
"stream_param":"txSecret=40f38f69f574fd51126c421a3d96c374&txTime=5DEBEC80",
"app":"testlive.myqcloud.com",
"appname":"live",
"appid":10000
}
CSS porn detection can be disabled by deleting the screencapture rule or modifying the screencapture template. Both deletion and modification are effective only for new live streams. If you want to disable CSS porn detection for a live stream that has already started, you have to stop and restart the stream.
Call DeleteLiveSnapshotRule to delete the corresponding CSS screencapture rule under DomainName
, AppName
, and StreamName
by template ID.
Call ModifyLiveSnapshotTemplate to set the porn detection flag of the CSS screencapture template to 0.
Was this page helpful?