Sha256: 117630bd22bf03c0d4f3b8f49ccf36db82aa4f6c253e34ab8dd19f0c8635af9b

Contents?: true

Size: 1.37 KB

Versions: 24

Compression:

Stored size: 1.37 KB

Contents

var session = OT.initSession(apiKey, sessionId),
    publisher = OT.initPublisher('publisher'),
    archiveID = null;

session.connect(token, function(error) {
  if (error) {
    console.error('Failed to connect', error);
  } else {
    session.publish(publisher, function(error) {
      if (error) {
        console.error('Failed to publish', error);
      }
    });
  }
});

session.on('streamCreated', function(event) {
  session.subscribe(event.stream, 'subscribers', {
    insertMode: 'append'
  }, function(error) {
    if (error) {
      console.error('Failed to subscribe', error);
    }
  });
});

session.on('archiveStarted', function(event) {
  archiveID = event.id;
  console.log('ARCHIVE STARTED');
  $('.start').hide();
  $('.stop').show();
  disableForm();
});

session.on('archiveStopped', function(event) {
  archiveID = null;
  console.log('ARCHIVE STOPPED');
  $('.start').show();
  $('.stop').hide();
  enableForm();
});

$(document).ready(function() {
  $('.start').click(function(event) {
    var options = $('.archive-options').serialize();
    disableForm();
    $.post('/start', options).fail(enableForm);
  }).show();
  $('.stop').click(function(event){
    $.get('stop/' + archiveID);
  }).hide();
});


function disableForm() {
  $('.archive-options-fields').attr('disabled', 'disabled');
}

function enableForm() {
  $('.archive-options-fields').removeAttr('disabled');
}

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
opentok-3.0.1 sample/Archiving/public/js/host.js
opentok-3.0.0 sample/Archiving/public/js/host.js
opentok-2.5.0 sample/Archiving/public/js/host.js
opentok-2.4.1 sample/Archiving/public/js/host.js