Yunxin classroom | how to realize audio and video security detection?

The pan entertainment audio and video chat scene is full of uncontrollable risk factors, such as pornography, violent fear and political information. With the increasingly strict national supervision, each platform needs to control the audio and video content of the platform, and it needs to invest a lot of manpower to process the audio and video content audit by itself.

Integrating the content audit capability of Netease Yunxin, a communication cloud expert, and Netease shield, it provides developers with real-time audio and video "security pass" (content security audit) services to effectively identify and screen audio and video content and reduce human investment.

In this Yunxin small class, we will bring you a quick access guide to real-time audio and video "secure communication".

Functional analysis

Real time audio and video "secure communication" (content security audit) service (hereinafter referred to as "secure communication") is based on the content audit and processing function of real-time audio and video calls. By default, our developers have realized the basic audio and video call function (if you haven't started integration, please refer to previous periods) Yunxin classroom | how to realize audio and video communication).

The basic functions of "secure communication" include:

  • Create security pass audit task
  • Screenshot of query audit video
  • Query audit audio break
  • Stop "secure communication" audit task
  • Receive safety audit results
  • Handling safety audit results

Based on the real-time audio and video call content, the whole process of "review check ban" service function is realized.

Function realization

The following content introduces how to quickly realize the audio and video call security detection function based on Netease cloud audio and video call 2.0 SDK and secure API. The basic steps are as follows:

Step 1 # start preparation

1. Log in to the Yunxin console to create an application and apply for the activation of audio and video 2.0 and "secure communication" related services. For detailed operation steps, please refer to:

Audio and video 2.0} access process:

https://doc.yunxin.163.com/do...

"Opening" security link "service:

https://doc.yunxin.163.com/do...

2. The public network address of the server ready to receive message CC. The audit results will be sent to your reserved CC address by message CC. Please prepare the CC address before opening the service and ensure that the CC address is valid for a long time. The configuration method is shown in the following figure:

3. Prepare the audio and video call development environment. Secure communication service supports audio and video 2.0 full terminal access detection. No matter what platform you use, the access process is the same.

4. Configure the rules related to content detection, and enter the policy configuration page on the "security link" function page. Here you can configure the security detection policy you want.

Step 2 create an audio and video call

Create room (optional)

Create audio and video call rooms through server API

https://doc.yunxin.163.com/do...

Pass in the specified room name and user id. During this test, we defined the room name as Netease test and the user id as 12345.

curl --location --request POST 'https://logic-dev.netease.im/v2/api/room' 
--header 'AppKey: ***' \  //Please use your app's appkey
--header 'Nonce: ***' \  //Random number with a maximum length of 128 characters.
--header 'CurTime: 1639555317' \  //The current Unix timestamp is the number of seconds from 0:00:00:00 on January 1, 1970 to the present. The data type is String.
--header 'CheckSum: ba193e4d4ba3991987eb72afe692095598552b79' \ //The calculation method is detailed in: https://doc.yunxin.163.com/docs/jcyOTA0ODM/TA5MjEzNTM?platformId=50326
--header 'Content-Type: application/json' 
--data-raw '{    
    "channelName": "neteasetest",    
    "mode": 2,    
    "uid": 12345
}'

Get the corresponding request return result:

{    
    "code": 200,    
    "errmsg": "reason code 200", //code 200 is the creation success. For other status codes, please refer to https://doc.yunxin.163.com/docs/jcyOTA0ODM/DY2NDIwMTM?platformId=50326    
    "cid": 1344424603797473
}

Note: "creating a room" is a non essential operation. Users can choose to create or not create it. Cloud audio and video 2.0} calls also support clients who do not create to directly join audio and video rooms.

Establish audio and video call

In order to facilitate the demonstration, we use the Web terminal for audio and video calls (our default developer has implemented the basic audio and video call function), pass in the same room name as when creating the room, and establish audio and video calls.

​​​​​​​

this.client.join({        
    channelName: "neteasetest", //Room name        
    uid: 12345, //User id        
    token: '' //Authentication token, see: https://doc.yunxin.163.com/docs/jcyOTA0ODM/TQ0MTI2ODQ?platformId=50002      
  });

After entering the room successfully, the call will officially begin.

Step 3

After the call is established, you can start the audit task of the corresponding room through the server API:

https://doc.yunxin.163.com/do...

​​​​​​​

curl --location --request POST 'https://logic-dev.netease.im/livewallsolution/submit' 
--header 'AppKey: ***' \  //Please use your app's appkey
--header 'Nonce: ***' \  //Random number with a maximum length of 128 characters.
--header 'CurTime: 1639555317' \  //The current Unix timestamp is the number of seconds from 0:00:00:00 on January 1, 1970 to the present. The data type is String.
--header 'CheckSum: ba193e4d4ba3991987eb72afe692095598552b79' \ //The calculation method is shown in: https://doc.yunxin.163.com/docs/jcyOTA0ODM/TA5MjEzNTM?platformId=50326--header 'Content-Type: application/json' 
--data-raw '{    
    "monitorUid": 666666,    
    "channelName": "neteasetest",    
    "detectType": 0,    
    "scFrequency": 5,    
    "callbackUrl": "***"  //See 2.1 for the address of receiving audit task
}'

Get the corresponding return result:

{    
    "code": 200,    
    "result": {        
        "taskId": "***", //Approval task id, which is used to query the details of subsequent approval tasks        
        "status": true,        
        "dataId": "235979990138017090111639568801012" //Netease Yunxin provides you with the unique identification of the automatically generated data. If you have any questions about the test results, please consult technical support according to dataId.    
    }
}

At this point, your audio and video call will officially enter the review stage.

Step 4 # receive safety audit results

Implement audit result receiving service

Previously, we have configured the public network address of the server to receive the message CC. During the security audit, the abnormal behavior will be called back to your configured address in real time. You need to receive the corresponding audit message in this address. We provide relevant examples of PHP parsing the CC content:

https://faq.yunxin.163.com/#K...

In this demonstration, we only receive and print the simplest CC content.

public String robot(@RequestBody String msg) {        
    logger.info(msg);        
    System.out.println(msg);        
    return "robot";    
  }

Normally, the audit CC will not be triggered. Only in case of problems, the CC of specific exception details will be triggered. See the following for details:

https://doc.yunxin.163.com/do...

Trigger violation content

Before the call, we configured some sensitive words as audit filter conditions in advance.

Next, we simulate relevant video content during video call:

Acceptance of audit results

Finally, the address you configured to accept the CC service will receive the audit results related to the call! Only video related audit results are shown here, and audio can also be audited synchronously. For the definition of the approval result field, see:

https://doc.yunxin.163.com/do...

​​​​​​​

{  
    "data": {    
      "dataId": "235979990138017090111639568801012",    
      "callback": "",    
      "channelName": "neteasetest",    
      "evidences": {      
        "video": {        
          "evidence": {          
            "uid": 12345,          
            "beginTime": 1639569545356,          
            "endTime": 1639569545356,          
            "type": 1,          
            "url": "https://yidun-video.nos-eastchina1.126.net/ur9j7xwis91ejyprqsuilchg04009rez_12345_1639569545374.jpg?Signature=GR%2FQRk37f8k7ukRVLkeTtZiQWNfRMEx%2BL0uIeogAQ5M%3D&Expires=1642161545&NOSAccessKeyId=7b107844ee8e4f9689d54c726e3273ff"        
          },        
          "labels": [{          
            "subLabels": [{            
              "subLabel": 400017,            
              "rate": 1.0,            
              "details": {              
                "hitInfos": ["study hard"],              
                "hitLocationInfos": [{                
                  "y1": 0.33333334,                
                  "x1": 0.20926562,                
                  "y2": 0.56666666,                
                  "x2": 0.7454219,                
                  "hitInfo": "study hard"              
                }],              
                "imageListInfos": [{                
                  "type": 2,                
                  "word": "study hard"              
                }]            
              }          
            }],          
            "level": 2,          
            "rate": 1.0,          
            "label": 400        
          }]      
        }    
      },    
      "censorSource": 2,    
      "channelId": 1344424603797473,    
      "taskId": "ur9j7xwis91ejyprqsuilchg04009rez",    
      "status": 101  
    },  
    "eventType": 400
  }

Step 5 # handling safety audit results

Remove member

Finding a call violation is only the first step of the security audit. Next, we need to deal with the results of the security audit. When configuring security policies, you can identify the audit strength according to your specific business situation.

According to the audit results, each service will have different strategies, or pop up relevant prompts on the client, or directly end the call. Yunxin's audio and video calls provide service API interfaces related to room management, which can remove members in the room or close the whole room. In the following, taking the removal of illegal room members as an example, the server moves out of the member interface:

https://doc.yunxin.163.com/do...

​​​​​​​

curl --location --request POST 'https://logic-dev.netease.im/v3/api/kicklist/members?cname=neteasetest1&uid=12345' 
--header 'AppKey: ***' \  //Please use your app's appkey
--header 'Nonce: ***' \  //Random number with a maximum length of 128 characters.
--header 'CurTime: 1639555317' \  //The current Unix timestamp is the number of seconds from 0:00:00:00 on January 1, 1970 to the present. The data type is String.
--header 'CheckSum: ba193e4d4ba3991987eb72afe692095598552b79' \ //The calculation method is detailed in: https://doc.yunxin.163.com/docs/jcyOTA0ODM/TA5MjEzNTM?platformId=50326
--header 'Content-Type: application/json' 
--data-raw ''

If the request returns no result, HTTP 200 means the request is successful.

Client processing

After that, the client will receive a callback for the removed room. Take the Web side as an example:

​​​​​​​

  this.client.on('client-banned', (event) => {      
    logger.log('peer-leave', event);      
    message.error('You have been kicked out of the room');    
  });

So far, the security audit of audio and video calls has completed the integrated operation of "audit, inspection and prohibition".

Step 6 # end the audit task

Finally, we need to end the audit task of the call channel

https://doc.yunxin.163.com/do...

​​​​​​​

curl --location --request POST 'https://logic-dev.netease.im/livewallsolution/feedback' 
--header 'AppKey: ***' \  //Please use your app's appkey
--header 'Nonce: ***' \  //Random number with a maximum length of 128 characters.
--header 'CurTime: 1639555317' \  //The current Unix timestamp is the number of seconds from 0:00:00:00 on January 1, 1970 to the present. The data type is String.
--header 'CheckSum: ba193e4d4ba3991987eb72afe692095598552b79' \ //The calculation method is detailed in: https://doc.yunxin.163.com/docs/jcyOTA0ODM/TA5MjEzNTM?platformId=50326
--header 'Content-Type: application/json' 
--data-raw '{    
    "realTimeInfoList": [        
        {        
        "channelName": "neteasetest",        
        "status": 100        
        }    
      ]
    }'

And get the corresponding return result:

{    
    "code": 200,    
    "result": [        
        {            
            "channelName": "neteasetest",            
            "result": 0,            
            "taskId": "ur9j7xwis91ejyprqsuilchg04009rez"        
         }    
     ]
}

General conclusion

The above is a detailed explanation of the quick access guide of Netease Yunxin real-time audio and video "security pass", which can be easily completed according to the above steps.

The increasing number of audio and video chat scenes means that each platform not only needs to control, but also needs a lot of manpower cost to audit the audio and video content of the platform. Netease Yunxin provides developers with real-time audio and video "security pass" (content security audit) services to effectively identify and screen audio and video content and reduce manpower investment.

Yunxin small class recommended reading

Phase I: how to realize audio and video call

Phase II: build a local "Clubhouse" in five steps

Phase III: 5 minutes to realize the PK wheat connection scenario at the Android end

Phase IV: quick realization of iOS PK connection in 5 minutes

Phase 5: build an online chat room from 0 in only 4 steps!

Phase 6: build an application level online chat room. Seven steps are enough

Issue 7: chat room content audit is a headache? 3-step solution

Phase 8: simple four steps to quickly build a collaborative office system

About Netease Yunxin

Netease Yunxin is an integrated communication cloud service expert built by integrating Netease's 24-year IM and audio and video technology, and a stable and easy-to-use communication and video PaaS platform.

Provide core capabilities and components integrating communication and video, including communication services such as IM instant messaging, 5G message platform, one click login, signaling, SMS and number privacy protection, audio and video services such as audio and video call, live broadcast, on-demand, interactive live broadcast and interactive whiteboard, video conference and other component services.

Netease Yunxin serves customers from Netease cloud music, tal, New Oriental, iFLYTEK, Bank of Nanjing and other industries. 100w + enterprise developers have access to Yunxin services.

Keywords: Front-end security

Added by anfo on Sat, 22 Jan 2022 01:58:03 +0200