Hi, I am trying to implement the WebRTC demo project for C++ Builder (64bits) which for the server has been successful.
However, for the client it apparently works correctly until the moment of joining one of the clients that is connected. The effect it should have is the full screen display of the connected user's camera but this does not happen, only the local camera itself is displayed although debugging the embedded browser html correctly adds the other user's tag.
This code works apparently fine and there are no errors due to special characters or escape sequences.
The code is exactly the same but migrated from Delphi (which works fine) to C++ Builder. An interesting fact is that for the client at the time of establishing the port of connection it is necessary to make a fix so that it compiles and it is that it is generated in the headers a function called SetPort that is called the same as one of Windows and it generates problems of linking, to solve this it is necessary to apply the directive #undef. I don't know if this could be related.
I leave attached the source code
I am waiting for your answer, thanks in advance. Client.zip (61.9 KB)
Might be a copy-paste issue, but the JSON strings for offer, answer and candidates are incorrect. They come as a JSON object already (represented as a string) so wrapping them with double quotes is going to produce an incorrect JSON. Try with this:
Something I wanted to add, is the need to put in the code the #undef directive to the SetPort function as without this the code does not link correctly due to the WebSocketClient component which is using this function to set the network port. I have been investigating and the possible cause is that SetPort is a windows function of Winspool which causes a conflict and although it works fine I don't know if this could cause problems in the future.
This is more related to TMS FNC WebSocket than TMS FNC WX Pack.
Assuming you are not going to use the conflicting SetPort somewhere else, it is probably safe for the time being. We are going to rename this private method though so no more #undef will be needed from the next version.