本帖最后由 小沈阳的弟弟 于 2020-10-28 12:22 编辑
function init()
{
setLogFile();
var methodCallbackJoinChannel = function (ret, err) {
alert("1");
}
agoraRtc.joinChannelSuccessListener(methodCallbackJoinChannel);
var methodCallbackRemoteVideoDecode = function (ret, err) {
//setupRemoteVideo(ret.uid);
alert("2");
}
agoraRtc.firstRemoteVideoDecodedListener(methodCallbackRemoteVideoDecode);
var methodCallbackLeaveChannel = function (ret, err) {
//agoraRtc.setupLocalVideo();
alert("3");
}
agoraRtc.leaveChannelListener(methodCallbackLeaveChannel);
var methodCallbackUserOffine = function (ret, err) {
//agoraRtc.setupRemoteVideo({ uid: ret.uid });
alert("4");
}
agoraRtc.remoteUserOfflineListener(methodCallbackUserOffine);
//打开视频哈
agoraRtc.enableVideo(function(ret) {
if (ret.code == 0) {
}
});
//打开视频哈
//设置聊天模式
agoraRtc. setChannelProfile({
profile:0
}, function(ret) {
if (ret.code == 0) {
//success
}
});
//设置聊天模式
//设置视频编码
agoraRtc.setVideoProfile({
width:360,
height:360,
frameRate:15,
bitrate:800
}, function(ret) {
});
//设置视频编码
//设置本地视频窗口
agoraRtc.setupLocalVideo({
rect:{ x:0, y:0, w:90, h:160 },
fixedOn:"msg_laidian_frame",
fixed:true,
renderMode:1
}, function(ret) {
if (ret.code == 0) {
//success
}
});
//设置本地视频窗口
//agoraRtc.startPreview(function(ret) {
//});
//加入频道
agoraRtc.joinChannel({
token:"",
channel:'xiaoshenyang',
uid:1
}, function(ret) {
if (ret.code == 0) {
//success
agoraRtc.muteLocalVideoStream({
mute:false
}, function(ret) {
});
agoraRtc.muteAllRemoteVideoStreams({
mute:false
}, function(ret) {
});
}
});
//加入频道
//alert("视频通话信息渲染完毕...");
}
function setLogFile() {
var param;
if (api.systemType == "android") {
param = { path: "/sdcard/agora_rtc.log" };
} else if (api.systemType == "ios") {
param = { path: "cache://agora_rtc.log" };
}
var resultCallback = function (ret, err) {
//alert(ret.code);
}
agoraRtc.setLogFile(param, resultCallback);
}