Hola, estoy actualizando un proyecto hecho con Laravel y usa OpenTok.js Code usa la última versión como dice la documentación oficial
Para utilizar las nuevas funciones disponibles en la última versión, configure el atributo src de la etiqueta de script para cargar la nueva biblioteca:
<script src="https://static.opentok.com/v2/js/opentok.min.js"></script>
Solía funcionar bien pero ahora falla en la siguiente línea: subscriber.getImgData(); y dice que no está definido. ¿Hay alguna forma de solucionarlo? Tal vez versiones anteriores de OpenTok en alguna parte
Además, este es mi fragmento de código:
var publisher = ''; var subscriber = ''; function startSession() { session = OT.initSession(apiKey, sessionId); // Subscribe to a newly created stream session.on('streamCreated', function(event) { subscriber = session.subscribe(event.stream, 'subscriber', { insertMode: 'append', width: '100%', height: '100%', preferredResolution: { width: 1280, height: 720 }, style: {buttonDisplayMode: 'off'} }, handleError); }); // Create a publisher publisher = OT.initPublisher('publisher', { insertMode: 'append', width: '100%', height: '100%', resolution: '1280x720', mirror: false, style: {buttonDisplayMode: 'off'} }, handleError); // Connect to the session session.connect(token, function(error) { // If the connection is successful, initialize a publisher and publish to the session if (error) { handleError(error); } else { session.publish(publisher, handleError); } }); $.ajax({ url: '/video/' + video_id + '/start', type: "POST", cache: false, dataType: 'json', data: { '_token': csrf_token, } }).done( function(data){ } ); $('#start-session-btn').hide(); showSessionControls(); activityWatcher(); } $('#take-photo').click(function() { var video = subscriber.getImgData(); var blob = base64ToBlob(video); var formData = new FormData(); formData.append('image', blob); formData.append("_token", csrf_token); $.ajax({ url: '/video/' + video_id, type: "POST", cache: false, contentType: false, processData: false, data: formData}).done( function(data){ VideoScreenGallery.addImg(data.id, data.path); } ); }); El error regresa en línea: var video = subscriber.getImgData(); y este es el error en si:
TypeError no detectado: subscriber.getImgData no es una función