From 5eb81072bc729a403a6148b656d6b88bce52463e Mon Sep 17 00:00:00 2001 From: Murat Dogan Date: Mon, 27 Jan 2025 17:32:39 +0100 Subject: [PATCH] v0.25.0 + getLibraryVersion function --- src/cpp/rtc-wrapper.cpp | 9 +++++++++ src/cpp/rtc-wrapper.h | 1 + src/lib/index.ts | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/cpp/rtc-wrapper.cpp b/src/cpp/rtc-wrapper.cpp index db2a298e..e59f3911 100644 --- a/src/cpp/rtc-wrapper.cpp +++ b/src/cpp/rtc-wrapper.cpp @@ -18,6 +18,7 @@ Napi::Object RtcWrapper::Init(Napi::Env env, Napi::Object exports) exports.Set("cleanup", Napi::Function::New(env, &RtcWrapper::cleanup)); exports.Set("preload", Napi::Function::New(env, &RtcWrapper::preload)); exports.Set("setSctpSettings", Napi::Function::New(env, &RtcWrapper::setSctpSettings)); + exports.Set("getLibraryVersion", Napi::Function::New(env, &RtcWrapper::getLibraryVersion)); return exports; } @@ -172,3 +173,11 @@ void RtcWrapper::setSctpSettings(const Napi::CallbackInfo &info) rtc::SetSctpSettings(settings); } + + +Napi::Value RtcWrapper::getLibraryVersion(const Napi::CallbackInfo &info) +{ + PLOG_DEBUG << "getLibraryVersion() called"; + Napi::Env env = info.Env(); + return Napi::String::New(info.Env(), RTC_VERSION); +} diff --git a/src/cpp/rtc-wrapper.h b/src/cpp/rtc-wrapper.h index 42ce8edb..55590796 100644 --- a/src/cpp/rtc-wrapper.h +++ b/src/cpp/rtc-wrapper.h @@ -18,6 +18,7 @@ class RtcWrapper static void initLogger(const Napi::CallbackInfo &info); static void cleanup(const Napi::CallbackInfo &info); static void setSctpSettings(const Napi::CallbackInfo &info); + static Napi::Value getLibraryVersion(const Napi::CallbackInfo &info); private: static inline std::unique_ptr logCallback = nullptr; }; diff --git a/src/lib/index.ts b/src/lib/index.ts index 8b1dd82e..e8754f97 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -8,6 +8,7 @@ export function preload(): void { nodeDataChannel.preload(); } export function initLogger(level: LogLevel): void { nodeDataChannel.initLogger(level); } export function cleanup(): void { nodeDataChannel.cleanup(); } export function setSctpSettings(settings: SctpSettings): void { nodeDataChannel.setSctpSettings(settings); } +export function getLibraryVersion(): string { return nodeDataChannel.getLibraryVersion(); } export interface Audio { addAudioCodec(payloadType: number, codec: string, profile?: string): void; @@ -158,6 +159,7 @@ export default { cleanup, preload, setSctpSettings, + getLibraryVersion, RtcpReceivingSession, Track, Video,