|
5#
楼主 |
发表于 2015-6-23 17:15:55
|
只看该作者
画中画的实现代码如下:
private void SetVideoSize()
{
pic_suserVideo.Width = 320;
pic_suserVideo.Height = 240;
pic_tuserVideo.Width = 960;
pic_tuserVideo.Height = 720;
this.pic_suserVideo.Location = new System.Drawing.Point(730, 270);
}
//操作双方音视频设备
public void OpenCameraAndSpeak(int userId, bool isopen)
{
if (isopen)
{
//打开呼叫者音视频
AnyChatCoreSDK.UserCameraControl(userId, true);
AnyChatCoreSDK.UserSpeakControl(userId, true);
if (userId == m_UserId)
{
AnyChatCoreSDK.SetVideoPos(userId, pic_suserVideo.Handle, 0, 0, pic_suserVideo.Width, pic_suserVideo.Height);
}
else
{
AnyChatCoreSDK.SetVideoPos(userId, pic_tuserVideo.Handle, 0, 0, pic_tuserVideo.Width, pic_tuserVideo.Height);
}
}
else
{
AnyChatCoreSDK.UserCameraControl(userId, false);
AnyChatCoreSDK.UserSpeakControl(userId, false);
}
//音量刷新
timer_speak.Enabled = isopen;
}
//进入房间成功
public void EnterRoomSuccess()
{
timer_call.Stop();
Bitmap bit = Properties.Resources._28;
bit.RotateFlip(RotateFlipType.Rotate180FlipY);
//pic_suser.Image = bit;
UserInfo tUserItem = GetUserInfoByUserId(getOtherInSession());
if (tUserItem != null)
{
lb_tuserName.Text = tUserItem.Name;
lb_suserName.Text = m_UserName;
pan_users.Hide();
pan_call.Hide();
pan_conversation.Dock = DockStyle.Fill;
pan_conversation.Show();
SetVideoSize();
OpenCameraAndSpeak(m_UserId, true);//打开自己的音视频
}
}
为何实现的画中画,对方显示的大图很模糊,自己显示的小图就很清晰?问题出在哪里?如何解决?
问题可能是以下的代码导致的
if (userId == m_UserId)
{
AnyChatCoreSDK.SetVideoPos(userId, pic_suserVideo.Handle, 0, 0, pic_suserVideo.Width, pic_suserVideo.Height);
}
else
{
AnyChatCoreSDK.SetVideoPos(userId, pic_tuserVideo.Handle, 0, 0, pic_tuserVideo.Width, pic_tuserVideo.Height);
} |
|