Question

How to include video recording and downloading in this code, My previous query in this question was solved successfully but now I need to have archiving feature in this solution.

<!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title></title>
    </head>
    <body>
      <div id="myPublisherDiv"></div>
      <div id="subscriberBucket"></div>

      <script src="https://static.opentok.com/webrtc/v2.2/js/opentok.min.js" ></script>
      <script type="text/javascript">

        var apiKey = "<YOUR API KEY>";
        var sessionId = "<YOUR SESSION ID>";
        var token = "<YOUR SESSION ID'S TOKEN>";

        session = OT.initSession(apiKey, sessionId);

      session.connect(token, function (err) {
              if (!err) {
                  session.publish("myPublisherDiv", { mirror: false });
              }
          });
          session.on({
              "streamCreated": function (event) {
                  session.subscribe(event.stream,  "subscriberBucket", { width: 600, height: 450 }, { insertMode: "append" });
              }
          });

      </script>
    </body>
    </html>

And please mention in yur answer if anything is wrong or not in this line

 session.on({
              "streamCreated": function (event) {
                  session.subscribe(event.stream,  "subscriberBucket", { width: 600, height: 450 }, { insertMode: "append" });
Was it helpful?

Solution

I tested on another OpenTok app and clicked on mute and sound icons but could not reproduce what you are seeing.
I then created a new very simple group video chat app, clicked on mute and sound icons and I also could not reproduce what you are seeing.

I will paste in my group video chat app, you can start from this and slowly add in your own code part by part. Then you will be able to see what is causing your session to disconnect. Here is my simple group video chat app:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <div id="myPublisherDiv"></div>
  <div id="subscriberBucket"></div>

  <script src="https://static.opentok.com/webrtc/v2.2/js/opentok.min.js" ></script>
  <script type="text/javascript">

    var apiKey = "<YOUR API KEY>";
    var sessionId = "<YOUR SESSION ID>";
    var token = "<YOUR SESSION ID'S TOKEN>";

    session = OT.initSession(apiKey, sessionId);

    session.connect(token, function(err){
        if( !err ){
          session.publish("myPublisherDiv");
        }
    });
    session.on({
        "streamCreated": function(event){
          session.subscribe( event.stream, "subscriberBucket", {insertMode: "append"} );
        }
    });

  </script>
</body>
</html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top