web端与app视频通话,由服务端创建token
@Component
public class AliRtcUtil {
// 监听端口
private int listen;
// 应用ID
@Value("${aliyun.rtc.appID}")
private String appID;
// 应用密钥
@Value("${aliyun.rtc.appKey}")
private String appKey;
// 服务地址
@Value("${aliyun.rtc.gslb}")
private String gslb;
// 频道随机码
private String nonce;
// 频道时间戳
private Long timestamp;
// 用户唯一标识
private String userID;
// 加入频道token
private String token;
// 生成token
public static String createToken(
String appId, String appKey, String channelId, String userId,
String nonce, Long timestamp
) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.update(appId.getBytes());
digest.update(appKey.getBytes());
digest.update(channelId.getBytes());
dig