### Start Ant Media Server Source: https://github.com/ant-media/ant-media-server/wiki/Publish-with-RTMP-&-Play-with-WebRTC Navigate to the installation directory and execute the startup script to launch the server. ```bash cd /path/to/ant-media-server ./start.sh ``` -------------------------------- ### Start roscore Source: https://github.com/ant-media/ant-media-server/wiki/Initial-Configuration Launches the ROS master node to verify the installation. ```bash roscore ``` -------------------------------- ### Start Apache Web Server Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Enable-SSL-for-Ant-Media-Server-? After successfully installing the SSL certificate, re-enable any services that were stopped, such as the Apache Web Server, by starting the service. ```bash sudo service apache2 start ``` -------------------------------- ### Run Installation Script Source: https://github.com/ant-media/ant-media-server/wiki/Beginners-Guide-To-Getting-Started-With-Ant-Media-server Executes the installation script for fresh installs or updates while preserving existing settings. ```bash sudo ./install_ant-media-server.sh -i [ANT_MEDIA_SERVER_INSTALLATION_FILE] ``` ```bash sudo ./install_ant-media-server.sh -i [ANT_MEDIA_SERVER_INSTALLATION_FILE] -r true ``` -------------------------------- ### Download Ant Media Server Installation Script Source: https://github.com/ant-media/ant-media-server/wiki/Start-Ant-Media-Server-on-AWS-(Single-Instance) Download the Ant Media Server installation script from the official GitHub repository. This script automates the server setup process. ```bash wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh ``` -------------------------------- ### Run Ant Media Server Installation Script (Fresh Install) Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Started Use this command for a clean, new installation of Ant Media Server. Replace '[ANT_MEDIA_SERVER_INSTALLATION_FILE]' with the actual path to your downloaded file. ```bash sudo ./install_ant-media-server.sh -i [ANT_MEDIA_SERVER_INSTALLATION_FILE] ``` -------------------------------- ### Download and Prepare Installation Script Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Started This command downloads the Ant Media Server installation script and makes it executable. Ensure you have wget installed. ```bash wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh chmod 755 install_ant-media-server.sh ``` -------------------------------- ### Run Ant Media Server Installation Script Source: https://github.com/ant-media/ant-media-server/wiki/Start-Ant-Media-Server-on-AWS-(Single-Instance) Execute the installation script to install Ant Media Server. You may need to provide the installation file as an argument, depending on the script's requirements. ```bash sudo ./install_ant-media-server.sh [ANT_MEDIA_SERVER_INSTALLATION_FILE] ``` -------------------------------- ### Connect and Start Streaming Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-iOS-SDK-Documentation Initiate the connection to the server and start the stream once the client is ready. ```swift client.connect() ``` ```swift client.start() ``` -------------------------------- ### Run Ant Media Server Installation Script (Update) Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Started Execute the installation script with the '-r true' flag to update an existing installation and preserve settings. Replace '[ANT_MEDIA_SERVER_INSTALLATION_FILE]' with the actual path to your downloaded file. ```bash sudo ./install_ant-media-server.sh -i [ANT_MEDIA_SERVER_INSTALLATION_FILE] -r true ``` -------------------------------- ### Start Video Source Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Android-SDK-Documentation Starts or restarts the video capture source. ```java void WebRTCClient.startVideoSource() ``` -------------------------------- ### Install ROS Noetic Desktop Full Source: https://github.com/ant-media/ant-media-server/wiki/Meet-Spaceport Installs the ROS Noetic desktop-full package. This is the equivalent installation for ROS Noetic on compatible Ubuntu versions. ```bash sudo apt install ros-noetic-desktop-full ``` -------------------------------- ### Enable MongoDB to Start at Boot Source: https://github.com/ant-media/ant-media-server/wiki/DB-Based-Clustering-(available-for-v1.5.1-and-later)-and-Autoscaling Configure MongoDB to automatically start when the system boots up. This ensures the database is available upon server restart. ```bash sudo systemctl enable mongod.service ``` -------------------------------- ### Install ROS Melodic Desktop Full Source: https://github.com/ant-media/ant-media-server/wiki/Compatible-With-Jetson-Nano-DK Installs the ROS Melodic distribution with the desktop-full variant, which includes a wide range of ROS packages. ```bash sudo apt install ros-melodic-desktop-full ``` -------------------------------- ### Download Installation Script Source: https://github.com/ant-media/ant-media-server/wiki/Beginners-Guide-To-Getting-Started-With-Ant-Media-server Downloads the shell script and sets the necessary execution permissions. ```bash wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh && chmod 755 install_ant-media-server.sh ``` -------------------------------- ### Configure SSL Source: https://github.com/ant-media/ant-media-server/wiki/Beginners-Guide-To-Getting-Started-With-Ant-Media-server Navigates to the installation directory and enables SSL for a specific domain. ```bash cd /usr/local/antmedia ``` ```bash sudo ./enable_ssl.sh -d {DOMAIN_NAME} ``` -------------------------------- ### Build Azure SDK for Spaceport Source: https://github.com/ant-media/ant-media-server/wiki/Spaceport-Publisher Navigates to the publisher directory and executes the setup script to build the Azure SDK. Ensure you have downloaded and extracted the Spaceport first. ```bash cd publisher bash setup.sh ``` -------------------------------- ### Set Permissions for Installation Script Source: https://github.com/ant-media/ant-media-server/wiki/Start-Ant-Media-Server-on-AWS-(Single-Instance) Make the downloaded installation script executable before running it. This is a standard step for executing shell scripts in Linux environments. ```bash chmod 755 install_ant-media-server.sh ``` -------------------------------- ### Install Certbot on Linux Source: https://github.com/ant-media/ant-media-server/wiki/Start-Ant-Media-Server-on-Azure Installs the Certbot utility required for obtaining SSL certificates. ```bash sudo apt-get install certbot ``` -------------------------------- ### Install CUDA Repository Meta-data on Ubuntu 16.04 Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Install the repository meta-data after downloading the CUDA deb file on Ubuntu 16.04. This prepares the system to install CUDA packages. ```bash sudo dpkg -i cuda-repo-ubuntu1604_10.1.105-1_amd64.deb ``` -------------------------------- ### Initialize rosdep Source: https://github.com/ant-media/ant-media-server/wiki/Initial-Configuration Installs and initializes the rosdep tool for managing system dependencies. ```bash sudo apt install python-rosdep sudo rosdep init rosdep update ``` -------------------------------- ### Execute Calibration and Registration Scripts Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Transformation-Matrices Commands to trigger the job distribution and start the registration process. ```bash cd Spaceport-Multi-Camera-Registration-Tool` `bash sendjob.sh $(($(date +%s%N)/1000000)) ``` ```bash cd /VolumetricVideoRegistration/src/registraiton` `bash startReg.sh ``` -------------------------------- ### Start Playing Stream Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Publish-&-Play-JavaScript-SDK Trigger the play method once the adaptor is initialized. ```javascript if (info == "initialized") { // it is called with this parameter when it connects to // Ant Media Server and everything is ok console.log("initialized"); webRTCAdaptor.play("stream1"); } ``` -------------------------------- ### Enable SSL with Domain Name Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Enable-SSL-for-Ant-Media-Server-? Execute the enable_ssl.sh script with the -d flag followed by your domain name to install the Let's Encrypt SSL certificate. ```bash sudo ./enable_ssl.sh -d example.com ``` -------------------------------- ### Install Docker CE and NVIDIA Docker2 on Host Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Instructions for installing Docker CE and NVIDIA Docker2 on a host Ubuntu 16.04 system. This is a prerequisite for running Ant Media Server in a Docker container with GPU support. ```bash curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \ sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \ sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update # Install nvidia-docker2 and reload the Docker daemon configuration sudo apt-get install -y nvidia-docker2 sudo pkill -SIGHUP dockerd ``` -------------------------------- ### Install CUDA Runtime 10.0 Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Install the CUDA Runtime 10.0 package. This provides the necessary libraries for running CUDA applications. ```bash sudo apt-get install cuda-runtime-10-0 ``` -------------------------------- ### Install ROS Dependencies Source: https://github.com/ant-media/ant-media-server/wiki/Spaceport-Publisher Installs essential packages for ROS development, including ninja-build, soundio, and udev. ```bash sudo apt-get install -y ninja-build sudo apt install libsoundio-dev apt-get install libudev-dev ``` -------------------------------- ### Install ROS build dependencies Source: https://github.com/ant-media/ant-media-server/wiki/Initial-Configuration Installs essential tools for building ROS packages. ```bash sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential ``` -------------------------------- ### Install MongoDB 5.0 Source: https://github.com/ant-media/ant-media-server/wiki/MongoDB-Replica-Set Installs version 5.0 of MongoDB from the official repository. Ensure you have the necessary GPG keys and repository sources configured. ```bash wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu `lsb_release -cs`/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list sudo apt-get update sudo apt-get install -y mongodb-org ``` -------------------------------- ### Run Ant Media Load Test Container Source: https://github.com/ant-media/ant-media-server/wiki/Preparation-of-Test-Server-and-Running-Tests Starts the container and executes the load testing jar file. ```bash $ sudo docker run -w "/home/antmedia/test" --name amstest -p 8090:8090 antmedia/test java -jar loadtester.jar ``` -------------------------------- ### Ping Output Example Source: https://github.com/ant-media/ant-media-server/wiki/Spaceport-Network-Setup Expected output format when successfully pinging the master machine. ```text PING hal(192.168.1.50) 56(84) bytes of data. 64 bytes from hal(192.168.1.50): icmp_seq=1 til=64 time=0.309ms 64 bytes from hal (192.168.1.50): icmp_seq=1 til=64 time=0.233ms 64 bytes from hal (192.168.1.50): icmp_seq=1 til=64 time=0.293ms 64 bytes from hal (192.168.1.50): icmp_seq=1 til=64 time=0.296ms ``` -------------------------------- ### Install iptables-persistent Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Started Installs the package required to save iptables rules across system reboots. ```bash sudo apt-get install iptables-persistent ``` -------------------------------- ### Start Streaming Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Android-SDK-Documentation Initiates the streaming process based on the mode set during initialization. ```java void WebRTCClient.startStream() ``` -------------------------------- ### Install CUDA Repository Meta-data on Ubuntu 18.04 Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Install the repository meta-data after downloading the CUDA deb file on Ubuntu 18.04. This configures the system to access CUDA packages. ```bash sudo dpkg -i cuda-repo-ubuntu1804_10.1.105-1_amd64.deb ``` -------------------------------- ### Start Stream Command for P2P Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Create-WebRTC-Peer-To-Peer-Communication The server sends this command to the first peer when a second peer joins the same stream. This indicates that the connection can proceed. ```json { command : "start", streamId : "stream1", } ``` -------------------------------- ### Start External Streams Source: https://github.com/ant-media/ant-media-server/wiki/External-Re-streaming_2 Initiates the fetching process for a provided list of broadcast objects. ```Java streamFetcherManager.startStreams(streams); ``` -------------------------------- ### Navigate to Ant Media Server Directory Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Enable-SSL-for-Ant-Media-Server-? Change the current directory to the Ant Media Server installation folder. The default path is /usr/local/antmedia. ```bash cd /usr/local/antmedia ``` -------------------------------- ### Enable and Restart MongoDB Service Source: https://github.com/ant-media/ant-media-server/wiki/MongoDB-Replica-Set Enables the MongoDB service to start on boot and then restarts the service to apply configuration changes. ```bash systemctl enable mongod systemctl restart mongod ``` -------------------------------- ### Configure and Run Multi-Camera Publishers Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Transformation-Matrices A bash script to start roscore and initiate k4AROSPublisher on multiple remote machines via SSH. Ensure the IP addresses and paths match your specific network configuration. ```bash #!/bin/bash # $(($(date +%s%N)/1000000)) if pgrep roscore >/dev/null 2>&1 then tput setaf 1; echo "roscore is already running" else roscore & tput setaf 1; echo "roscore just started" sleep 4 fi ssh antmedia@192.168.0.107 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.107 export ROS_MASTER_URI=http://hal:11311 /home/antmedia/Softwares/Azure-Kinect-Sensor-SDK/build/devel/lib/K4A/k4AROSPublisher --postime $1 EOF ssh antmedia@192.168.0.103 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.103 export ROS_MASTER_URI=http://hal:11311 /home/alitokur/Softwares/Azure-Kinect-Sensor-SDK/build/devel/lib/K4A/k4AROSPublisher --postime $1 EOF ssh antmedia@192.168.0.106 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.106 export ROS_MASTER_URI=http://hal:11311 /home/antmedia/Softwares/Azure-Kinect-Sensor-SDK/build/devel/lib/K4A/k4AROSPublisher --postime $1 EOF ssh antmedia@192.168.0.109 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.109 export ROS_MASTER_URI=http://hal:11311 /home/antmedia/Softwares/Azure-Kinect-Sensor-SDK/build/devel/lib/K4A/k4AROSPublisher --postime $1 EOF ssh antmedia@192.168.0.102 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.102 export ROS_MASTER_URI=http://hal:11311 /home/antmedia/Softwares/Azure-Kinect-Sensor-SDK/build/devel/lib/K4A/k4AROSPublisher --postime $1 EOF ``` -------------------------------- ### Start ROS Publishers via SSH Source: https://github.com/ant-media/ant-media-server/wiki/Multi-Camera-Registration A bash script to connect to multiple remote devices via SSH and launch the k4AROSPublisher with specific ROS environment variables. ```sh #!/bin/bash # $(($(date +%s%N)/1000000)) if pgrep roscore >/dev/null 2>&1 then tput setaf 1; echo "roscore is already running" else roscore & tput setaf 1; echo "roscore just started" sleep 4 fi #device_1 ssh antmedia@192.168.0.107 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.107 export ROS_MASTER_URI=http://hal:11311 /home/path/of/k4AROSPublisher --postime $1 EOF #device_2 ssh antmedia@192.168.0.103 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.103 export ROS_MASTER_URI=http://hal:11311 /home/path/of/k4AROSPublisher --postime $1 EOF #device_3 ssh antmedia@192.168.0.106 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.106 export ROS_MASTER_URI=http://hal:11311 /home/path/of/k4AROSPublisher --postime $1 EOF #device_4 ssh antmedia@192.168.0.109 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.109 export ROS_MASTER_URI=http://hal:11311 /home/path/of/k4AROSPublisher --postime $1 EOF #device_5 ssh antmedia@192.168.0.102 << EOF & source /opt/ros/melodic/setup.bash export DISPLAY=:0 export ROS_IP=192.168.0.102 export ROS_MASTER_URI=http://hal:11311 /home/path/of/k4AROSPublisher --postime $1 EOF ``` -------------------------------- ### Docker Compose Volume Configuration (Commented) Source: https://github.com/ant-media/ant-media-server/wiki/Docker-and-Docker-Compose-Installation Example of how to configure persistent volumes within a docker-compose.yml file. This section is commented out and shows how to mount an existing volume. ```yaml # volumes: # - antmedia_vol:/usr/local/antmedia/ #volumes: # antmedia_vol: # external: true # name: # antmedia_volume ``` -------------------------------- ### Configure Webhook via Postman Source: https://github.com/ant-media/ant-media-server/wiki/Webhook-Integration:-No-worry,-We'll-call-you Example JSON collection for Postman to create a broadcast with a custom listenerHookURL. ```json { "variables": [], "info": { "name": "samples", "_postman_id": "cbef37ab-d4ae-c349-4845-b4a91d1ab201", "description": "", "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" }, "item": [ { "name": "http://localhost:5080/LiveApp/rest/broadcast/create", "request": { "url": "http://localhost:5080/LiveApp/rest/broadcast/create", "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "description": "" } ], "body": { "mode": "raw", "raw": "{\"name\":\"test_video\", \"listenerHookURL\":\"http://www.example.com/webhook\"}" }, "description": "ListenerHookURL sample" }, "response": [] } ] } ``` -------------------------------- ### Start Publishing a Stream Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Publish-&-Play-JavaScript-SDK Call the `publish(streamName)` method on the `webRTCAdaptor` object within the 'initialized' callback to begin streaming. Ensure the stream name is unique. ```javascript if (info == "initialized") { // it is called with this parameter when it connects to // Ant Media Server and everything is ok console.log("initialized"); webRTCAdaptor.publish("stream1"); } ``` -------------------------------- ### Download CUDA Repository for Ubuntu 16.04 Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Download the deb file for the CUDA repository on Ubuntu 16.04. This is the first step in installing the CUDA toolkit. ```bash wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_10.1.105-1_amd64.deb ``` -------------------------------- ### Download CUDA Repository for Ubuntu 18.04 Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Download the deb file for the CUDA repository on Ubuntu 18.04. This is the initial step for CUDA toolkit installation on this version. ```bash wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.105-1_amd64.deb ``` -------------------------------- ### Configure Bash for ROS Source: https://github.com/ant-media/ant-media-server/wiki/Compatible-With-Jetson-Nano-DK Sources the ROS setup script in your .bashrc file to make ROS commands available in your terminal session. This should be done after installing ROS. ```bash echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc ``` ```bash source ~/.bashrc ``` -------------------------------- ### Take Configuration (Offer) Command Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Create-WebRTC-Peer-To-Peer-Communication The first peer sends its offer SDP to the server using this command. Replace ${SDP_PARAMETER} with the actual SDP offer. ```json { command : "takeConfiguration", streamId : "stream1", type : "offer", sdp : "${SDP_PARAMETER}" } ``` -------------------------------- ### Run Ant Media Server in DB Based Cluster Mode Source: https://github.com/ant-media/ant-media-server/wiki/DB-Based-Clustering-(available-for-v1.5.1-and-later)-and-Autoscaling Execute this command to start Ant Media Server in DB based cluster mode. Replace `` with your MongoDB server's IP address. Ensure port 5000 TCP is open for inter-node communication. ```bash sudo ./change_server_mode.sh cluster ``` -------------------------------- ### Implement MainActivity onCreate Source: https://github.com/ant-media/ant-media-server/wiki/Step-by-Step-Guide-to-Build-WebRTC-Native-Android-App Initializes the WebRTC client within the activity lifecycle. Ensure SERVER_URL is configured correctly and choose the appropriate mode (PUBLISH, PLAY, or JOIN). ```java public class MainActivity extends AbstractWebRTCActivity { public static final String SERVER_URL = "ws://192.168.1.21:5080/WebRTCAppEE/websocket"; private CallFragment callFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //below exception handler show the exception in a popup window //it is better to use in development, do not use in production Thread.setDefaultUncaughtExceptionHandler(new UnhandledExceptionHandler(this)); // Set window styles for fullscreen-window size. Needs to be done before // adding content. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility(getSystemUiVisibility()); setContentView(R.layout.activity_main); webRTCClient = new WebRTCClient( this,this); String streamId = "stream" + (int)(Math.random() * 999); String tokenId = "tokenID"; SurfaceViewRenderer cameraViewRenderer = findViewById(R.id.camera_view_renderer); SurfaceViewRenderer pipViewRenderer = findViewById(R.id.pip_view_renderer); webRTCClient.setVideoRenderers(pipViewRenderer, cameraViewRenderer); // if you want to play mode, you should change IWebRTCClient.MODE_PLAY instead to IWebRTCClient.MODE_PUBLISH webRTCClient.init(SERVER_URL, streamId, IWebRTCClient.MODE_PUBLISH, tokenId); webRTCClient.startStream(); } } ``` -------------------------------- ### Initialize AntMediaClient Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-iOS-SDK-Documentation Instantiate the client object to begin configuration. ```swift let client = AntMediaClient.init() ``` -------------------------------- ### Download Docker Compose and Dockerfile Source: https://github.com/ant-media/ant-media-server/wiki/Docker-and-Docker-Compose-Installation Download the docker-compose.yml file and the Dockerfile_Process for setting up Ant Media Server with Docker Compose. ```bash wget https://raw.githubusercontent.com/ant-media/Scripts/master/docker/docker-compose.yml wget https://raw.githubusercontent.com/ant-media/Scripts/master/docker/Dockerfile_Process -O Dockerfile ``` -------------------------------- ### Take Configuration (Answer) Command Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Create-WebRTC-Peer-To-Peer-Communication The second peer sends its answer SDP to the server using this command. Replace ${SDP_PARAMETER} with the actual SDP answer. ```json { command : "takeConfiguration", streamId : "stream1", type : "answer", sdp : "${SDP_PARAMETER}" } ``` -------------------------------- ### Enable Clustering via Command Line Source: https://github.com/ant-media/ant-media-server/wiki/Clustering Commands to navigate to the configuration directory, swap the container configuration files, and restart the service. ```bash cd /usr/local/antmedia/conf ``` ```bash mv jee-container.xml jee-container-standalone.xml ``` ```bash mv jee-container-cluster.xml jee-container.xml ``` ```bash sudo service antmedia stop sudo service antmedia start ``` -------------------------------- ### Enable SSL with External Certificate Files Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Enable-SSL-for-Ant-Media-Server-? For versions 1.5+, you can use the enable_ssl.sh script with external fullchain.pem and privkey.pem files. Provide the paths to these files and your domain name using the -f, -p, and -d flags. ```bash Usage: sudo ./enable_ssl.sh -d {DOMAIN_NAME} sudo ./enable_ssl.sh -f {FULL_CHAIN_FILE} -p {PRIVATE_KEY_FILE} -d {DOMAIN_NAME} ``` -------------------------------- ### Install CUDA Compatibility Packages Source: https://github.com/ant-media/ant-media-server/wiki/Enable-NVIDIA-GPU-Encoder-Support Install specific CUDA packages for compatibility if the latest CUDA runtime version (e.g., 10.1) causes issues. These packages ensure compatibility with older CUDA versions. ```bash sudo apt install cuda-cudart-10-0 sudo apt install cuda-compat-10-0 ``` -------------------------------- ### WebRTCClient Stream Control Source: https://github.com/ant-media/ant-media-server/wiki/Step-by-Step-Guide-to-Build-WebRTC-Native-Android-App Methods for starting, stopping, and managing the stream lifecycle. ```APIDOC ## WebRTCClient.startStream Starts the streaming process based on the initialized mode. ## WebRTCClient.stopStream Stops the current streaming session. ## WebRTCClient.startVideoSource Starts or restarts the video source. ## WebRTCClient.stopVideoSource Stops the video source. ``` -------------------------------- ### WebRTCClient.init Source: https://github.com/ant-media/ant-media-server/wiki/Step-by-Step-Guide-to-Build-WebRTC-Native-Android-App Initializes the WebRTC client with the server URL, stream ID, operation mode, and optional token. ```APIDOC ## WebRTCClient.init ### Description Initializes the connection to the Ant Media Server. ### Parameters - **url** (String) - Required - The websocket URL to connect to. - **streamId** (String) - Required - The stream ID to process. - **mode** (String) - Required - Operation mode: IWebRTCClient.MODE_PUBLISH, IWebRTCClient.MODE_PLAY, or IWebRTCClient.MODE_JOIN. - **token** (String) - Optional - One-time token string for authentication. ``` -------------------------------- ### Download Dockerfile for Ant Media Server Source: https://github.com/ant-media/ant-media-server/wiki/Docker-and-Docker-Compose-Installation Use this command to download the Dockerfile for building the Ant Media Server image. ```bash wget https://raw.githubusercontent.com/ant-media/Scripts/master/docker/Dockerfile_Process -O Dockerfile ``` -------------------------------- ### Launch Jetson Nano Publishers Source: https://github.com/ant-media/ant-media-server/wiki/Compatible-With-Jetson-Nano-DK Navigates to the 'binaries' directory and executes the launch script for the Jetson Nano publishers. Ensure Spaceport is downloaded and extracted. ```bash cd binaries bash launch.sh ``` -------------------------------- ### Manage Ant Media Service Source: https://github.com/ant-media/ant-media-server/wiki/Beginners-Guide-To-Getting-Started-With-Ant-Media-server Commands to check the status of the service or stop and start it. ```bash sudo service antmedia status ``` ```bash sudo service antmedia stop sudo service antmedia start ``` -------------------------------- ### Configure AntMediaClient Options Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-iOS-SDK-Documentation Set the delegate, server URL, stream ID, mode, and video views before establishing a connection. ```swift client.delegate = self client.setOptions(url: server, streamId: room, mode: self.getMode()) client.setVideoViews(local: localVideoView, remote: remoteVideoView) ``` -------------------------------- ### Get Error Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Android-SDK-Documentation Retrieves the last error message if any occurred. Returns null if there is no error. ```java String WebRTCClient.getError() ``` -------------------------------- ### WebRTCClient Configuration and UI Source: https://github.com/ant-media/ant-media-server/wiki/Step-by-Step-Guide-to-Build-WebRTC-Native-Android-App Methods for configuring camera settings, video rendering, and audio controls. ```APIDOC ## WebRTCClient.setOpenFrontCamera - **openFrontCamera** (boolean) - Required - If true, attempts to open the front camera. ## WebRTCClient.switchCamera Switches between available cameras. ## WebRTCClient.toggleMic - **Returns** (boolean) - The current status of the microphone. ## WebRTCClient.setVideoRenderers - **pipRenderer** (SurfaceViewRenderer) - Optional - Renderer for Picture-in-Picture. - **fullscreenRenderer** (SurfaceViewRenderer) - Required - Main renderer. ``` -------------------------------- ### Include JavaScript Dependencies Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Conference-Call---Outdated Add the required WebRTC adapter and Ant Media SDK scripts to the document head. ```javascript ... ... ``` -------------------------------- ### Run Docker Compose in Detached Mode Source: https://github.com/ant-media/ant-media-server/wiki/Docker-and-Docker-Compose-Installation Start all services defined in the docker-compose.yml file in detached mode. ```bash docker-compose up -d ``` -------------------------------- ### Locate Configuration File Source: https://github.com/ant-media/ant-media-server/wiki/Dash-Playing(CMAF) Path to the application configuration file for WebRTCAppEE. ```text /usr/local/antmedia/webapps/WebRTCAppEE/WEB-INF/red5-web.properties ``` -------------------------------- ### Define Static Cluster Members Source: https://github.com/ant-media/ant-media-server/wiki/Clustering Example configuration for adding multiple static nodes to the cluster list. ```xml ``` -------------------------------- ### WebRTCClient Initialization and Control Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Android-SDK-Documentation Methods for initializing the WebRTC client, starting/stopping streams, and managing camera settings. ```APIDOC ## WebRTCClient.init ### Description Initializes the WebRTC client with server connection details and stream configuration. ### Parameters - **url** (String) - Required - WebSocket URL to connect. - **streamId** (String) - Required - The stream ID in the server to process. - **mode** (String) - Required - Operation mode: MODE_PUBLISH, MODE_PLAY, or MODE_JOIN. - **token** (String) - Required - One-time token string. ## WebRTCClient.startStream ### Description Starts the streaming process based on the initialized mode. ## WebRTCClient.stopStream ### Description Stops the current streaming session. ## WebRTCClient.setOpenFrontCamera ### Description Configures the camera preference. ### Parameters - **openFrontCamera** (boolean) - Required - If true, attempts to open the front camera; if false, attempts to open another camera. ``` -------------------------------- ### Build Ant Media Docker Image Source: https://github.com/ant-media/ant-media-server/wiki/Preparation-of-Test-Server-and-Running-Tests Builds the Docker image from the downloaded Dockerfile. ```bash $ sudo docker build -f Dockerfile_AntMediaTest -t antmedia/test . ``` -------------------------------- ### Restart MongoDB Service Source: https://github.com/ant-media/ant-media-server/wiki/DB-Based-Clustering-(available-for-v1.5.1-and-later)-and-Autoscaling Use this command to restart the MongoDB service. Ensure MongoDB is installed and configured correctly. ```bash sudo service mongod restart ``` -------------------------------- ### Build Ant Media Server Docker Image Source: https://github.com/ant-media/ant-media-server/wiki/Docker-and-Docker-Compose-Installation Build the Docker image for Ant Media Server. Ensure the Ant Media Server ZIP file is in the same directory. Replace `` with the actual filename. ```bash docker build --network=host -t antmediaserver --build-arg AntMediaServer= . ``` -------------------------------- ### Control Ant Media Server Service Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Started These commands are used to stop and start the Ant Media Server service as needed. ```bash sudo service antmedia stop ``` ```bash sudo service antmedia start ``` -------------------------------- ### WebSocket Error: Local Description Not Set Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-WebSocket-Messaging-Details This error is returned when the local description in the WebRTC connection setup has not been successfully set. ```json { "command" : "error", "definition" : "notSetLocalDescription" } ``` -------------------------------- ### WebSocket Error: No Peer Associated Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-WebSocket-Messaging-Details This error indicates a problem with peer-to-peer connection setup, specifically when no peer has been associated with the stream. ```json { "command" : "error", "definition" : "no_peer_associated_before" } ``` -------------------------------- ### HTML Video Elements Setup Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Signalling-Server Define video elements in the body of your HTML file to display local and remote video streams. ```html ``` -------------------------------- ### Uninstall Ant Media Server Directory Source: https://github.com/ant-media/ant-media-server/wiki/Beginners-Guide-To-Getting-Started-With-Ant-Media-server Removes the Ant Media Server installation directory. Ensure no critical data is lost before execution. ```bash sudo rm -rf /usr/local/antmedia/ ``` -------------------------------- ### Navigate to Download Directory Source: https://github.com/ant-media/ant-media-server/wiki/Getting-Started Use this command to change your current directory to where the Ant Media Server zip file was downloaded. ```bash cd path/to/where/ant-media-server....zip ``` -------------------------------- ### Create PFX File with OpenSSL Source: https://github.com/ant-media/ant-media-server/wiki/Start-Ant-Media-Server-on-Azure Converts PEM certificate files into a PFX format suitable for Azure Application Gateway. ```bash sudo openssl pkcs12 -inkey ./privkey.pem -in ./cert.pem -export -out murat.antmedia.io.pfx ``` -------------------------------- ### Verify Ant Media Server Uninstallation Source: https://github.com/ant-media/ant-media-server/wiki/Beginners-Guide-To-Getting-Started-With-Ant-Media-server Checks if the Ant Media Server installation directory has been removed. This command will return an error if the directory still exists. ```bash /usr/local/antmedia ``` -------------------------------- ### Initialize WebRTCAdaptor Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-Publish-&-Play-JavaScript-SDK Configure and instantiate the WebRTCAdaptor object with connection settings and callback handlers. ```javascript var pc_config = null; var sdpConstraints = { OfferToReceiveAudio : true, OfferToReceiveVideo : true }; var mediaConstraints = { video : true, audio : true }; var webRTCAdaptor = new WebRTCAdaptor({ websocket_url : "ws://" + location.hostname + ":"+ location.port +"/WebRTCAppEE", mediaConstraints : mediaConstraints, peerconnection_config : pc_config, sdp_constraints : sdpConstraints, remoteVideoId : "remoteVideo", isPlayMode: true, callback : function(info) { if (info == "initialized") { console.log("initialized"); } else if (info == "play_started") { //play_started console.log("play started"); } else if (info == "play_finished") { // play finishedthe stream console.log("play finished"); } }, callbackError : function(error) { //some of the possible errors, NotFoundError, SecurityError,PermissionDeniedError console.log("error callback: " + error); alert(error); } }); ``` -------------------------------- ### Enable DASH and LL-HLS Source: https://github.com/ant-media/ant-media-server/wiki/Dash-Playing(CMAF) Properties to add to red5-web.properties to enable DASH and experimental LL-HLS. ```properties settings.dashMuxingEnabled=true ``` ```properties settings.dash.llHlsEnabled=true ``` -------------------------------- ### Stop Apache Web Server Source: https://github.com/ant-media/ant-media-server/wiki/How-to-Enable-SSL-for-Ant-Media-Server-? If Apache Web Server is running and using port 80, it must be stopped before proceeding with SSL installation. This command disables the service. ```bash sudo service apache2 stop ``` -------------------------------- ### Server Notification: New Stream Joined Source: https://github.com/ant-media/ant-media-server/wiki/WebRTC-WebSocket-Messaging-Details This notification is sent to all peers in a room when a new participant joins and starts streaming. The `streamId` can be used to play the new stream. ```json { command : "notification", definition : "streamJoined", streamId: "new_stream_id_joined_the_room" } ``` -------------------------------- ### Launch Publishers with Synchronous Time Source: https://github.com/ant-media/ant-media-server/wiki/Spaceport-Publisher Launches all cameras synchronously using the --postime argument. The value should be the current time in microseconds for correct capture. Replace $(($(date +%s%N)/1000000)) with your desired time if testing. ```bash --postime $(($(date +%s%N)/1000000)) ``` -------------------------------- ### Build and Run Docker Commands Source: https://github.com/ant-media/ant-media-server/wiki/Building-and-Running-Docker-Container-for-Ant-Media-Server Commands to build the Docker image from the Dockerfile and execute the container with host networking and privileged access. ```bash docker build --network=host -t antmediaserver --build-arg AntMediaServer= . ``` ```bash docker run --network=host --privileged=true -it antmediaserver ```