How to Record and Save Zoom Meeting to Aws S3 Storage Using Meeting Sdk for Windows on Docker
#meeting sdk #windows #docker #recording #aws #s3 storage
How to record and save Zoom Meeting to AWS S3 Storage using Meeting SDK for Windows on Docker
The Zoom Meeting SDK Recording on Container Sample provides you with the sample to get started with Meeting Recording in a Windows based Dockerized environment, and uploading to AWS S3 for persistent storage.
In this guide, we will be going over
- Code walkthrough on Meeting SDK for Windows
- Compilation and Runtime in Docker Environment
- Running the Image in Docker Environment
What to bring
You will need
- General App or Meeting SDK Client ID and Client Secret
- Runtime environment: Docker on Windows or Windows Server
Dockerfile
A sample dockerfile is provided as part of this guide. We have included it in the repo to help you quickly deploy and scale up recording instances of Meeting SDK.
Base & Dependencies
This dockerfile is generated for windowsservercore-ltsc2019.
You can choose other modern Windows based images, as the following concept will still apply.
Note: You will need a Windows based docker environment to host this.
To ensure high levels of compatibility, I opted to copy and compile the project from within the image. Alternatively you can compile locally on your machine and copy the executable files, but do ensure you have all the necessary runtime and dependencies if you choose this path.
To compile from within the image, the below packages and dependencies have been added. The first run might take a while.
## Use the appropriate Windows base image
#FROM mcr.microsoft.com/windows:20H2
#
## Enable non-interactive installs
#ARG DEBIAN_FRONTEND=noninteractive
ARG REPO=mcr.microsoft.com/dotnet/framework/runtime
FROM $REPO:4.8-windowsservercore-ltsc2019
# Install Chocolatey package manager
RUN powershell -Command \
Set-ExecutionPolicy Bypass -Scope Process -Force; \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install dependencies
RUN choco install -y git
RUN choco install -y cmake
RUN choco install -y mingw
RUN choco install -y make
RUN choco install -y wget
RUN choco install -y unzip
RUN choco install -y awscli
RUN choco install -y visualstudio2022buildtools --install-arguments \
"--add Microsoft.VisualStudio.Workload.NativeDesktop \
--add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools \
--add Microsoft.VisualStudio.Component.TestTools.BuildTools \
--add Microsoft.Component.MSBuild \
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended \
--add Microsoft.VisualStudio.Component.VC.CMake.Project \
--add Microsoft.VisualStudio.Component.VC.ATLMFC \
--add Microsoft.VisualStudio.Component.VC.ATL \
--add Microsoft.VisualStudio.Component.VC.MFC \
--add Microsoft.VisualStudio.Component.CMake \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 \
--add Microsoft.VisualStudio.Workload.VCTools \
--add Microsoft.VisualStudio.Component.VC.v143.x86.x64 \
--add Microsoft.VisualStudio.Component.VC.140"
WORKDIR /temp
ADD https://aka.ms/vs/17/release/vs_buildtools.exe vs_buildtools.exe
SHELL ["cmd", "/S", "/C"]
RUN (start /w C:\temp\vs_buildtools.exe --quiet --wait --norestart --nocache modify \
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" \
--add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools \
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended \
--add Microsoft.Component.MSBuild \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \
--remove Microsoft.VisualStudio.Component.Windows81SDK \
|| IF "%ERRORLEVEL%"=="3010" EXIT 0)
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
VCPKG This project utilizes vcpkg package manager to install dependencies
WORKDIR /vcpkg
# Clone vcpkg repository
RUN git clone https://github.com/Microsoft/vcpkg.git c:\vcpkg
# Bootstrap vcpkg
RUN .\bootstrap-vcpkg.bat
# Integrate vcpkg
RUN .\vcpkg integrate install --vcpkg-root c:\vcpkg
# Install curl
RUN .\vcpkg install curl
# Install jsoncpp
RUN .\vcpkg install jsoncpp
Build and Entry
# Set the PATH environment variable
ENV PATH="${PATH};C:\Windows\System32\WindowsPowerShell\v1.0"
ENV PATH="${PATH};C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin"
ENV PATH="${PATH};C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0"
ENV PATH="${PATH};C:\Program Files\Amazon\AWSCLIV2"
# Set the working directory
WORKDIR /app
# Copy everything from the specified directory
COPY / /app/
# Build the project using MSBuild
RUN msbuild /t:Build /p:Configuration=Debug /p:Platform=x64
# Set the working directory
WORKDIR C:/app/x64/Debug
# Set the entry point to run the command prompt
CMD ["powershell.exe", "-Command", "C:/app/x64/Debug/LocalRecording.exe"]
#CMD ["powershell.exe"]
#docker run -it local-recording-image --volume c:\temp:c:\users\ContainerAdministrator\Documents\zoom
Configure the App
This sample utilizes config.json to retrieve necessary information to authenticate the SDK and join Zoom Meeting.
{
"sdk_jwt":"xxxxx.yyyyyyyyy.zzzzzzzz",
"meeting_number": "1231231231234",
"passcode": "123123",
"zak": ""
}
Main Starting Point
The main entry for this project is MSDK_LocalRecording.cpp
The application starts from the int main()
method, and runs in a message loop.
The key process which happens here are
LoadConfig()
will load configuration values from config.jsonInitSDK
will initialize SDK using the values from config.json- Call
SDKAuth()
and attempt to join a meeting usingJoinMeeting()
method.
- Call
- Wait until SDK is fully in the meeting, and attempt to start local recording in
onInMeeting()
method.- If SDK has no permission yet, the logic will prompt the host for local recording permission by calling
m_pRecordController->RequestLocalRecordingPrivilege();
- If host provides host, co-host or local recording permission, SDK will continue with
attemptToStartLocalRecording()
- If SDK has no permission yet, the logic will prompt the host for local recording permission by calling
- The SDK will recording to a dynamically generated folder, found within
c:\users\ContainerAdministrator\Documents\zoom
- When the host ends the meeting or when SDK leaves the meeting, the encoding process will kick off.
while (!encoderEnded)
will check for encoding completion, and run the aws cli command. Currently a placeholder has been set for you
std::wstring commandLine = L"aws.exe help"; // Replace with the command line of the process you want to run
Recording Modes
There are 2 recording modes which you can choose from.
void SwitchToGalleryView()
will let you toggle between Active Speaker and Gallery View recording mode.
//helper class to switch between active speaker and gallery view, based on the boolean control variable (isGalleryView)
void SwitchToGalleryView() {
printf("SwitchToGalleryView Invoked\n");
IMeetingUIController* meetingUIController = meetingService->GetUIController();
if (isGalleryView) {
SDKError err = meetingUIController->SwitchToVideoWall();
if (err != SDKERR_SUCCESS) {
std::cout << "Error occurred switching view";
}
}
else {
SDKError err = meetingUIController->SwtichToAcitveSpeaker();
if (err != SDKERR_SUCCESS) {
std::cout << "Error occurred switching view";
}
}
}