1 个不稳定版本

0.1.3 2022年2月11日

#332多媒体

Download history 72/week @ 2024-03-11 14/week @ 2024-03-25 33/week @ 2024-04-01 51/week @ 2024-04-15 17/week @ 2024-04-22 6/week @ 2024-04-29 1/week @ 2024-05-06 44/week @ 2024-05-13 81/week @ 2024-05-20 10/week @ 2024-05-27 1/week @ 2024-06-03 35/week @ 2024-06-10 24/week @ 2024-06-17 9/week @ 2024-06-24

每月 69 次下载

MIT 许可证

19KB
365 代码行

OpenTok Server Rust SDK

Rust

OpenTok Server Rust SDK包装了OpenTok REST API。它允许开发人员安全地创建会话并为使用Vonage Video API的应用程序生成令牌。开发人员还可以使用服务器SDK与OpenTok存档一起工作。与OpenTok客户端SDK一起使用。

用法

    let api_key = env::var("OPENTOK_KEY").unwrap();
    let api_secret = env::var("OPENTOK_SECRET").unwrap();
    let opentok = OpenTok::new(api_key, api_secret);
    let session_id = opentok.create_session(SessionOptions::default()).await;
    let token = opentok.generate_token(session_id, TokenRole::Publisher);

运行测试

测试期望一个正常工作的网络连接并定义以下环境变量

export OPENTOK_KEY=<your-opentok-api-key>
export OPENTOK_SECRET=<your-opentok-api-secret>

测试使用了OpenTok客户端SDK,因此您需要安装其依赖项,从OpenTok Linux SDK开始

wget https://tokbox.com/downloads/libopentok_linux_llvm_x86_64-2.19.1
tar xvf libopentok_linux_llvm_x86_64-2.19.1 -C /home/quijote/opentok
export LD_LIBRARY_PATH="/home/quijote/opentok/libopentok_linux_llvm_x86_64-2.19.1/lib:$LD_LIBRARY_PATH"
export LIBRARY_PATH="/home/quijote/opentok/libopentok_linux_llvm_x86_64-2.19.1/lib:$LIBRARY_PATH"

还需要GStreamer

sudo apt -y install libgstreamer-plugins-base1.0-dev

依赖项

~21MB
~490K SLoC