Recently, it has been found that more friends feedback in the use of Chat SDK audio and video solutions, especially in the standard Android demo videoactivity video part of the code to be ported to their own projects encountered local video black screen or remote video display is not 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
possible causes of the problem: no audio and video parameters, no Java acquisition mode used
Workaround: Put the standard demo insidehallactivityThe 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)
Android Video two times development technology