Skip to content

Commit

Permalink
v0.25.0 + getLibraryVersion function
Browse files Browse the repository at this point in the history
  • Loading branch information
murat-dogan committed Jan 27, 2025
1 parent 1203971 commit 5eb8107
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cpp/rtc-wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions src/cpp/rtc-wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ThreadSafeCallback> logCallback = nullptr;
};
Expand Down
2 changes: 2 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -158,6 +159,7 @@ export default {
cleanup,
preload,
setSctpSettings,
getLibraryVersion,
RtcpReceivingSession,
Track,
Video,
Expand Down

0 comments on commit 5eb8107

Please sign in to comment.