简体   繁体   中英

Is it possible, to play wav or mp3 file, in the conference room in Ant Media Server?

Is it possible, to play wav or mp3 file, in the conference room. Before other person join to the room? The ideas is create conference room. Then "join" MP3 file as a participant. After file have finished playing, then invite other person to join the room

Yes, it's possible to add any stream to track to the video conference room programmatically. Let me tell how to do that step by step.

  1. Create a video conference room with multitrack-conference.html file. Let's call it "room1"
  2. Add MP3 as a Stream Source(VoD) to Ant Media Server as "mp3Stream"
curl -X 'POST' 'http://localhost:5080/WebRTCAppEE/rest/v2/broadcasts/create' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"streamId":"mp3stream","type":"VoD","streamUrl":"http://localhost:5080/WebRTCAppEE/streams/file_example_MP3_5MG.mp3"}'
  1. Start the stream by using it's id mp3stream
curl -X 'POST' \
  'http://localhost:5080/WebRTCAppEE/rest/v2/broadcasts/mp3stream/start' \
  -H 'accept: application/json'
  1. Add "mp3stream" as a subtrack to the "room1" with the following command
curl -X 'POST'   'http://localhost:5080/WebRTCAppEE/rest/v2/broadcasts/room1/subtrack?id=mp3stream'   -H 'accept: application/json' 

It will start playing automatically in the page as it's working for me.

在此处输入图像描述

For REST Methods https://antmedia.io/rest

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM