Sha256: 798ddb7ec2ac2845733e1a24d6ae8daa5a5da2bba80c411526cfdbdfc109bdda

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

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

session.connect(apiKey, token, function(err, info) {
  if(err) {
    alert(err.message || err);
  }
  session.publish(publisher);
});

session.on('streamCreated', function(event) {
  session.subscribe(event.stream, 'subscribers', { insertMode: 'append' });
});

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

5 entries across 5 versions & 1 rubygems

Version Path
opentok-2.4.0.beta.1 sample/Archiving/public/js/host.js
opentok-2.3.4 sample/Archiving/public/js/host.js
opentok-2.3.3 sample/Archiving/public/js/host.js
opentok-2.3.2 sample/Archiving/public/js/host.js
opentok-2.3.0 sample/Archiving/public/js/host.js