• The issue I am having is that my javascript for tokbox which enables a live video stream only displays below the footer/wrapper regardless of where I place it in the php code.

    Are there any solutions to this? I’ve used firebug to try and CSS it back into place with no luck.

    The code I am embedding is:

    <div id=“JS-Container”>
    <script type="text/javascript">
      var apiKey    = "X";
      var sessionId = "Y";
      var token     = "Z";
    
      function sessionConnectedHandler (event) {
         session.publish( publisher );
         subscribeToStreams(event.streams);
      }
      function subscribeToStreams(streams) {
        for (var i = 0; i < streams.length; i++) {
            var stream = streams[i];
            if (stream.connection.connectionId
                   != session.connection.connectionId) {
                session.subscribe(stream);
            }
        }
      }
      function streamCreatedHandler(event) {
        subscribeToStreams(event.streams);
      }
    
      var publisher = TB.initPublisher(apiKey);
      var session   = TB.initSession(sessionId);
    
      session.connect(apiKey, token);
      session.addEventListener("sessionConnected",
                               sessionConnectedHandler);
    
      session.addEventListener("streamCreated",
                               streamCreatedHandler);
    </script>
    </div>

    It works fine where it is, but it looks really bad. See the test page at https://test.yourclass.net/classroom

Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What do you mean by the JavaScript only displays? What is the JavaScript generating?

    Thread Starter yourclass

    (@yourclass)

    It’s a video feed. If you load the page I linked to you will see a video feed at the bottom left of the screen. I used the code that I pasted to insert it just below the header but for some reason it only displays below the footer.

    The code is pasted into a php page template file just for this page- not into the post editor. Would that make a difference? Could I paste this into the post editor? Note: I’ve tried pasting it into the editor but it didn’t seem to work.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I can’t see the video at all, sorry.

    OT.Publisher.onStreamAvailableError Permission Denied TB.min.js:32
    (anonymous function) TB.min.js:32
    w TB.min.js:257
    o
    Thread Starter yourclass

    (@yourclass)

    I should have mentioned its webRTC. So a chrome and FF only.

    [Moderator Note: No bumping. If it’s that urgent, consider hiring someone.]

    Thread Starter yourclass

    (@yourclass)

    In case it help, I’ve followed the directions here: https://tokbox.com/opentok/quick-start/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Javascript (tokbox) only appears below footer?’ is closed to new replies.