Recently, found that there are more friends feedback in the use of Anychat audio and video solutions, especially in the standard Android demo videoactivity video part of the code porting to its own project encountered local video black screen or remote video display can not be a problem. These problems were also encountered during the course of my development, where I made a simple summary and a corresponding solution to my own problem-solving experience.
1, local video black screen, not display
problem possible cause: no audio and video parameters are set, no Java acquisition mode
Workaround: Put the standard demo inside hallactivity The applyvideoconfig function in the class is ported to the project and is called after the SDK is initialized, as shown below
Initializing the SDK
Anychat. INITSDK (Android.os.Build.VERSION.SDK_INT, 0);
Setting audio and Video parameters
Applyvideoconfig ();
Copy Code
(Note: You need to set parameters after initialization to be valid)
2, local video can be displayed, remote video black screen, not display
possible causes of the problem: The remote video binding is not Surfaceview
Workaround: Call the binding code before requesting a remote video operation, as shown below
If you are using Java video display, you need to set the callback of your surface
if (Anychatcoresdk.getsdkoptionint (anychatdefine.brac_so_videoshow_driverctrl) = = Anychatdefine.videoshow_driver_ JAVA) {
int index = Anychat.mVideoHelper.bindVideo (Otherview.getholder ());
Anychat.mVideoHelper.SetVideoUser (index, UserID);
}
Request Remote Video
Anychat. Usercameracontrol (UserID, 1);
Anychat. Userspeakcontrol (UserID, 1);
Copy Code
(Note: This code needs to be called if there are multiple places to request remote video.) If you have a remote audio and video operation in both Onanychatonlineusermessage and onanychatuseratroommessage, you need to call the code above)
Talking about Anychat audio and video solution for Android video display problem