Skip to content

Commit

Permalink
Merge pull request #3 from chrisnyoder/webgl-specific-compilation
Browse files Browse the repository at this point in the history
Webgl specific compilation
  • Loading branch information
icywind authored Oct 1, 2021
2 parents 1903583 + 9a975c0 commit d029aa5
Show file tree
Hide file tree
Showing 3 changed files with 1,293 additions and 1,261 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class IRtcEngineNative
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
public const string MyLibName = "agoraSdkCWrapper";
#else
#if UNITY_IPHONE || UNITY_WEBGL
#if UNITY_IOS || UNITY_WEBGL
public const string MyLibName = "__Internal";
#else
public const string MyLibName = "agoraSdkCWrapper";
Expand Down Expand Up @@ -264,8 +264,10 @@ public class IRtcEngineNative
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteAudioStream(uint uid, bool mute);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteAudioStream_WGLM(string uid, bool mute);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int switchCamera();
Expand All @@ -281,8 +283,11 @@ public class IRtcEngineNative

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteVideoStream(uint uid, bool mute);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteVideoStream_WGLM(string uid, bool mute);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setLogFile(string filePath);
Expand Down Expand Up @@ -646,11 +651,14 @@ public class IRtcEngineNative

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setCameraCapturerConfiguration(int cameraCaptureConfiguration, int cameraDirection, int width, int height);

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteUserPriority(uint uid, int userPriority);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteUserPriority_WGL(string uid, int userPriority);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setLogFileSize(uint fileSizeInKBytes);
Expand Down Expand Up @@ -694,17 +702,21 @@ public class IRtcEngineNative
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern IntPtr getUserInfoByUid(uint uid);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern IntPtr getUserInfoByUid_WGL(string uid);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setBeautyEffectOptions(bool enabled, int lighteningContrastLevel, float lighteningLevel, float smoothnessLevel, float rednessLevel);

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setInEarMonitoringVolume(int volume);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern void startScreenCaptureForWeb();
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int startScreenCaptureByDisplayId(uint displayId, int x, int y, int width, int height, int screenCaptureVideoDimenWidth, int screenCaptureVideoDimenHeight, int screenCaptureFrameRate, int screenCaptureBitrate, bool screenCaptureCaptureMouseCursor);
Expand Down Expand Up @@ -741,14 +753,18 @@ public class IRtcEngineNative

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int startChannelMediaRelay(string srcChannelName, string srcToken , uint srcUid, string destChannelName, string destToken, uint destUid, int destCount);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int startChannelMediaRelay_WEBGL(string srcChannelName, string srcToken, string srcUid, string destChannelName, string destToken, string destUid, int destCount);

#endif
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int updateChannelMediaRelay(string srcChannelName, string srcToken , uint srcUid, string destChannelName, string destToken, uint destUid, int destCount);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int updateChannelMediaRelay_WEBGL(string srcChannelName, string srcToken, string srcUid, string destChannelName, string destToken, string destUid, int destCount);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int stopChannelMediaRelay();
Expand Down Expand Up @@ -789,8 +805,10 @@ public class IRtcEngineNative
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int adjustUserPlaybackSignalVolume(uint uid, int volume);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern void adjustUserPlaybackSignalVolume_WGLM(string uid, int volume);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setMultiChannelWant(bool multiChannelWant);
Expand Down Expand Up @@ -952,8 +970,7 @@ protected static extern void initChannelEventCallback(IntPtr channel, ChannelOnW
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern void initEventOnMetaDataCallback(EngineEventOnMediaMetaDataReceived onMetadataReceived, EngineEventOnReadyToSendMetadata onReadyToSendMetadata, EngineEventOnGetMaxMetadataSize onGetMaxMetadataSize);



#if UNITY_EDITOR || UNITY_WEBGL
//WebGL Video Renderer APIs from ASH
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern void setVideoDeviceCollectionDeviceWGL(string deviceID);
Expand Down Expand Up @@ -990,6 +1007,8 @@ protected static extern void initChannelEventCallback(IntPtr channel, ChannelOnW

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
public static extern void setCurrentChannel_WGL(string channelId);
#endif


// 3.0 multi channel
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
Expand Down Expand Up @@ -1038,8 +1057,10 @@ protected static extern void initChannelEventCallback(IntPtr channel, ChannelOnW
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteUserPriority2(IntPtr channel, uint uid, int userPriority);

#if UNITY_WEBGL
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteUserPriority2_WGLM(IntPtr channel, string uid, int userPriority);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteVoicePosition2(IntPtr channel, uint uid, double pan, double gain);
Expand All @@ -1059,29 +1080,37 @@ protected static extern void initChannelEventCallback(IntPtr channel, ChannelOnW
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int adjustUserPlaybackSignalVolume2(IntPtr channel, uint userId, int volume);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int adjustUserPlaybackSignalVolume2_WGLM(IntPtr channel, string userId, int volume);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteAudioStream2(IntPtr channel, uint userId, bool mute);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteAudioStream2_WGLM(IntPtr channel, string userId, bool mute);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteAllRemoteVideoStreams2(IntPtr channel, bool mute);

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteVideoStream2(IntPtr channel, uint userId, bool mute);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int muteRemoteVideoStream2_WGLM(IntPtr channel, string userId, bool mute);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteVideoStreamType2(IntPtr channel, uint userId, int streamType);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteVideoStreamType2_WGLM(IntPtr channel, string userId, int streamType);
#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int setRemoteDefaultVideoStreamType2(IntPtr channel, int streamType);
Expand Down Expand Up @@ -1113,17 +1142,18 @@ protected static extern void initChannelEventCallback(IntPtr channel, ChannelOnW
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int startChannelMediaRelay2(IntPtr channel, string srcChannelName, string srcToken , uint srcUid, string destChannelName, string destToken, uint destUid, int destCount);

#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int startChannelMediaRelay2_WEBGL(IntPtr channel, string srcChannelName, string srcToken, string srcUid, string destChannelName, string destToken, string destUid, int destCount);

#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int updateChannelMediaRelay2(IntPtr channel, string srcChannelName, string srcToken , uint srcUid, string destChannelName, string destToken, uint destUid, int destCount);


#if UNITY_WEBGL || UNITY_EDITOR
[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int updateChannelMediaRelay2_WEBGL(IntPtr channel, string srcChannelName, string srcToken, string srcUid, string destChannelName, string destToken, string destUid, int destCount);

#endif

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int stopChannelMediaRelay2(IntPtr channel);
Expand Down Expand Up @@ -1211,6 +1241,6 @@ protected static extern void initChannelEventCallback(IntPtr channel, ChannelOnW

[DllImport(MyLibName, CharSet = CharSet.Ansi)]
protected static extern int enableVirtualBackground(bool enabled, int background_source_type, uint color, string source);
#endregion engine callbacks
#endregion engine callbacks
}
}
Loading

0 comments on commit d029aa5

Please sign in to comment.