How to enable recording in Twilio Video conference?










0















I'm having trouble enabling 'RecordParticipantsOnConnect' as stated here: https://www.twilio.com/docs/video/api/recordings-resource in my twilio implementation but i can't seem to get it working, where do i set RecordParticipantsOnConnect to true?



They say you need to pass this option when you're creating a room, but i'm not creating any room, it's done automatically i'm just passing a room name as a string and i get the token:



class TwilioServices
ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
API_KEY_SID = ENV['TWILIO_API_KEY_SID']
API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

def self.get_token(type, room)
# Create an Access Token
token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

# Grant access to Video
grant = Twilio::JWT::AccessToken::VideoGrant.new
grant.room = room
token.add_grant grant
# Serialize the token as a JWT
token.to_jwt
end
end


How do i solve this?










share|improve this question


























    0















    I'm having trouble enabling 'RecordParticipantsOnConnect' as stated here: https://www.twilio.com/docs/video/api/recordings-resource in my twilio implementation but i can't seem to get it working, where do i set RecordParticipantsOnConnect to true?



    They say you need to pass this option when you're creating a room, but i'm not creating any room, it's done automatically i'm just passing a room name as a string and i get the token:



    class TwilioServices
    ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
    API_KEY_SID = ENV['TWILIO_API_KEY_SID']
    API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

    def self.get_token(type, room)
    # Create an Access Token
    token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

    # Grant access to Video
    grant = Twilio::JWT::AccessToken::VideoGrant.new
    grant.room = room
    token.add_grant grant
    # Serialize the token as a JWT
    token.to_jwt
    end
    end


    How do i solve this?










    share|improve this question
























      0












      0








      0








      I'm having trouble enabling 'RecordParticipantsOnConnect' as stated here: https://www.twilio.com/docs/video/api/recordings-resource in my twilio implementation but i can't seem to get it working, where do i set RecordParticipantsOnConnect to true?



      They say you need to pass this option when you're creating a room, but i'm not creating any room, it's done automatically i'm just passing a room name as a string and i get the token:



      class TwilioServices
      ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
      API_KEY_SID = ENV['TWILIO_API_KEY_SID']
      API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

      def self.get_token(type, room)
      # Create an Access Token
      token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

      # Grant access to Video
      grant = Twilio::JWT::AccessToken::VideoGrant.new
      grant.room = room
      token.add_grant grant
      # Serialize the token as a JWT
      token.to_jwt
      end
      end


      How do i solve this?










      share|improve this question














      I'm having trouble enabling 'RecordParticipantsOnConnect' as stated here: https://www.twilio.com/docs/video/api/recordings-resource in my twilio implementation but i can't seem to get it working, where do i set RecordParticipantsOnConnect to true?



      They say you need to pass this option when you're creating a room, but i'm not creating any room, it's done automatically i'm just passing a room name as a string and i get the token:



      class TwilioServices
      ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
      API_KEY_SID = ENV['TWILIO_API_KEY_SID']
      API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

      def self.get_token(type, room)
      # Create an Access Token
      token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

      # Grant access to Video
      grant = Twilio::JWT::AccessToken::VideoGrant.new
      grant.room = room
      token.add_grant grant
      # Serialize the token as a JWT
      token.to_jwt
      end
      end


      How do i solve this?







      ruby-on-rails twilio twilio-api






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 16:19









      4 R4C81D4 R4C81D

      124




      124






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Twilio developer evangelist here.



          If you are letting the SDK dynamically creating the room when you join it then you won't be able to set the recording flag in your code. Instead, you have two choices:



          1. You can configure your room default settings in the Twilio console. Here you can set the rooms to default to group rooms and to turn recording on. (You can't record peer-to-peer rooms because the media does not go through Twilio servers.)



          2. You can create your room up front using the Video Rooms REST API. When creating a room yourself, you can also set the type and whether it is recorded. To do so, you'd update your get_token method to something like:



            class TwilioServices
            ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
            API_KEY_SID = ENV['TWILIO_API_KEY_SID']
            API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

            def self.get_token(type, room)
            # Create an Access Token
            token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

            client = Twilio::REST::Client.new(API_KEY_SID, API_KEY_SECRET, ACCOUNT_SID)
            video_room = client.video.rooms.create(
            unique_name: room,
            record_participants_on_connect: true,
            type: 'group'
            )

            # Grant access to Video
            grant = Twilio::JWT::AccessToken::VideoGrant.new
            grant.room = room
            token.add_grant grant
            # Serialize the token as a JWT
            token.to_jwt
            end
            end


          Let me know if that helps at all.






          share|improve this answer























          • Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

            – 4 R4C81D
            Nov 14 '18 at 13:56











          • Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

            – philnash
            Nov 14 '18 at 22:05











          • One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

            – 4 R4C81D
            Nov 15 '18 at 8:31












          • Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

            – philnash
            Nov 15 '18 at 10:29











          • what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

            – 4 R4C81D
            Nov 15 '18 at 10:45











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285227%2fhow-to-enable-recording-in-twilio-video-conference%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Twilio developer evangelist here.



          If you are letting the SDK dynamically creating the room when you join it then you won't be able to set the recording flag in your code. Instead, you have two choices:



          1. You can configure your room default settings in the Twilio console. Here you can set the rooms to default to group rooms and to turn recording on. (You can't record peer-to-peer rooms because the media does not go through Twilio servers.)



          2. You can create your room up front using the Video Rooms REST API. When creating a room yourself, you can also set the type and whether it is recorded. To do so, you'd update your get_token method to something like:



            class TwilioServices
            ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
            API_KEY_SID = ENV['TWILIO_API_KEY_SID']
            API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

            def self.get_token(type, room)
            # Create an Access Token
            token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

            client = Twilio::REST::Client.new(API_KEY_SID, API_KEY_SECRET, ACCOUNT_SID)
            video_room = client.video.rooms.create(
            unique_name: room,
            record_participants_on_connect: true,
            type: 'group'
            )

            # Grant access to Video
            grant = Twilio::JWT::AccessToken::VideoGrant.new
            grant.room = room
            token.add_grant grant
            # Serialize the token as a JWT
            token.to_jwt
            end
            end


          Let me know if that helps at all.






          share|improve this answer























          • Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

            – 4 R4C81D
            Nov 14 '18 at 13:56











          • Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

            – philnash
            Nov 14 '18 at 22:05











          • One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

            – 4 R4C81D
            Nov 15 '18 at 8:31












          • Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

            – philnash
            Nov 15 '18 at 10:29











          • what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

            – 4 R4C81D
            Nov 15 '18 at 10:45
















          0














          Twilio developer evangelist here.



          If you are letting the SDK dynamically creating the room when you join it then you won't be able to set the recording flag in your code. Instead, you have two choices:



          1. You can configure your room default settings in the Twilio console. Here you can set the rooms to default to group rooms and to turn recording on. (You can't record peer-to-peer rooms because the media does not go through Twilio servers.)



          2. You can create your room up front using the Video Rooms REST API. When creating a room yourself, you can also set the type and whether it is recorded. To do so, you'd update your get_token method to something like:



            class TwilioServices
            ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
            API_KEY_SID = ENV['TWILIO_API_KEY_SID']
            API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

            def self.get_token(type, room)
            # Create an Access Token
            token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

            client = Twilio::REST::Client.new(API_KEY_SID, API_KEY_SECRET, ACCOUNT_SID)
            video_room = client.video.rooms.create(
            unique_name: room,
            record_participants_on_connect: true,
            type: 'group'
            )

            # Grant access to Video
            grant = Twilio::JWT::AccessToken::VideoGrant.new
            grant.room = room
            token.add_grant grant
            # Serialize the token as a JWT
            token.to_jwt
            end
            end


          Let me know if that helps at all.






          share|improve this answer























          • Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

            – 4 R4C81D
            Nov 14 '18 at 13:56











          • Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

            – philnash
            Nov 14 '18 at 22:05











          • One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

            – 4 R4C81D
            Nov 15 '18 at 8:31












          • Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

            – philnash
            Nov 15 '18 at 10:29











          • what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

            – 4 R4C81D
            Nov 15 '18 at 10:45














          0












          0








          0







          Twilio developer evangelist here.



          If you are letting the SDK dynamically creating the room when you join it then you won't be able to set the recording flag in your code. Instead, you have two choices:



          1. You can configure your room default settings in the Twilio console. Here you can set the rooms to default to group rooms and to turn recording on. (You can't record peer-to-peer rooms because the media does not go through Twilio servers.)



          2. You can create your room up front using the Video Rooms REST API. When creating a room yourself, you can also set the type and whether it is recorded. To do so, you'd update your get_token method to something like:



            class TwilioServices
            ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
            API_KEY_SID = ENV['TWILIO_API_KEY_SID']
            API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

            def self.get_token(type, room)
            # Create an Access Token
            token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

            client = Twilio::REST::Client.new(API_KEY_SID, API_KEY_SECRET, ACCOUNT_SID)
            video_room = client.video.rooms.create(
            unique_name: room,
            record_participants_on_connect: true,
            type: 'group'
            )

            # Grant access to Video
            grant = Twilio::JWT::AccessToken::VideoGrant.new
            grant.room = room
            token.add_grant grant
            # Serialize the token as a JWT
            token.to_jwt
            end
            end


          Let me know if that helps at all.






          share|improve this answer













          Twilio developer evangelist here.



          If you are letting the SDK dynamically creating the room when you join it then you won't be able to set the recording flag in your code. Instead, you have two choices:



          1. You can configure your room default settings in the Twilio console. Here you can set the rooms to default to group rooms and to turn recording on. (You can't record peer-to-peer rooms because the media does not go through Twilio servers.)



          2. You can create your room up front using the Video Rooms REST API. When creating a room yourself, you can also set the type and whether it is recorded. To do so, you'd update your get_token method to something like:



            class TwilioServices
            ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
            API_KEY_SID = ENV['TWILIO_API_KEY_SID']
            API_KEY_SECRET = ENV['TWILIO_API_KEY_SECRET']

            def self.get_token(type, room)
            # Create an Access Token
            token = Twilio::JWT::AccessToken.new ACCOUNT_SID, API_KEY_SID, API_KEY_SECRET, ttl: 7200, identity: type,

            client = Twilio::REST::Client.new(API_KEY_SID, API_KEY_SECRET, ACCOUNT_SID)
            video_room = client.video.rooms.create(
            unique_name: room,
            record_participants_on_connect: true,
            type: 'group'
            )

            # Grant access to Video
            grant = Twilio::JWT::AccessToken::VideoGrant.new
            grant.room = room
            token.add_grant grant
            # Serialize the token as a JWT
            token.to_jwt
            end
            end


          Let me know if that helps at all.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 3:47









          philnashphilnash

          37.7k93454




          37.7k93454












          • Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

            – 4 R4C81D
            Nov 14 '18 at 13:56











          • Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

            – philnash
            Nov 14 '18 at 22:05











          • One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

            – 4 R4C81D
            Nov 15 '18 at 8:31












          • Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

            – philnash
            Nov 15 '18 at 10:29











          • what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

            – 4 R4C81D
            Nov 15 '18 at 10:45


















          • Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

            – 4 R4C81D
            Nov 14 '18 at 13:56











          • Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

            – philnash
            Nov 14 '18 at 22:05











          • One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

            – 4 R4C81D
            Nov 15 '18 at 8:31












          • Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

            – philnash
            Nov 15 '18 at 10:29











          • what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

            – 4 R4C81D
            Nov 15 '18 at 10:45

















          Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

          – 4 R4C81D
          Nov 14 '18 at 13:56





          Thanks, this solves the problem, although i got confused a bit trying to understand the relatio between video room and token, i mean how the configurations used to create room get passed along with the token, but i believe sharing the same room name "grant.room = room" does the job. Thanks alot

          – 4 R4C81D
          Nov 14 '18 at 13:56













          Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

          – philnash
          Nov 14 '18 at 22:05





          Yep, the room's identifier is it's name so when you grant access to that room for that token it connects the user to the room you created (as long as they connect within 5 minutes, otherwise the room will be closed).

          – philnash
          Nov 14 '18 at 22:05













          One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

          – 4 R4C81D
          Nov 15 '18 at 8:31






          One last question @philnash, in my app the room name is always the same everytime a conference is started, it is already statistically defined, but i get an error from Twilio saying that the room already exists, how can i solve this?

          – 4 R4C81D
          Nov 15 '18 at 8:31














          Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

          – philnash
          Nov 15 '18 at 10:29





          Don't know what you mean by "statistically defined" but if you are running the above code for each person that is trying to join the room then the first person will get in and then the room will be created. You could use the REST API to try to fetch the room by unique name first and if it exists just create the token, otherwise create the room.

          – philnash
          Nov 15 '18 at 10:29













          what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

          – 4 R4C81D
          Nov 15 '18 at 10:45






          what i mean is the room unique name isn't unique after all, it's defined like this: room = "GENERAL-ROOM", when i try to reconnect with the same name it says the room is already created.

          – 4 R4C81D
          Nov 15 '18 at 10:45


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285227%2fhow-to-enable-recording-in-twilio-video-conference%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          What does pagestruct do in Eviews?

          Dutch intervention in Lombok and Karangasem

          Channel Islands