PolyvUtils.java
926 Bytes
package com.subsidy.util;
import net.polyv.live.v1.util.LiveSignUtil;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
public class PolyvUtils {
/**
* 学生端--生成保利威视直播观看地址
*/
public static String liveSign(String userId, String channelId){
//根据实际情况设置userid
String ts = String.valueOf(System.currentTimeMillis());
String url = "https://live.polyv.cn/watch/"+channelId;
String signText = "03sqxr97fo"+ userId +"03sqxr97fo"+ts;
try {
String sign = LiveSignUtil.md5Hex(signText);
url += "?userid="+userId+"&ts="+ts+"&sign="+sign;
return url;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
}