startRecording无法使用RecordRTC与RTCMultiConnection一起工作

时间:2017-08-23 16:39:17

标签: webrtc recordrtc rtcmulticonnection

我正在尝试记录添加到RTCMultiConnection的每个新会话/用户。
我在应用程序中使用以下演示URL https://rtcmulticonnection.herokuapp.com/demos/Audio+Video+TextChat+FileSharing.html

现在我已经在代码中添加了以下cdn引用。 https://cdn.webrtc-experiment.com/RecordRTC.js

这是我正在使用的代码,但connection.streams[event.streamid].startRecording();无效。

// ..................RTCMultiConnection Code............. // ...................................................... var connection = new RTCMultiConnection(); var btnStopRec = document.getElementById("btnStopRecording"); connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/'; connection.enableFileSharing = true; connection.session = { audio: true, video: true, data: true, }; connection.sdpConstraints.mandatory = { OfferToReceiveAudio: true, OfferToReceiveVideo: true, }; connection.onstream = function (event) { document.body.appendChild(event.mediaElement); console.log("stream recording starts") connection.streams[event.streamid].startRecording(); console.log("stream recording started") }

1 个答案:

答案 0 :(得分:2)

我在下面的单个代码段中包含了所有可能的情况。请只使用您需要的代码:

import numpy
from keras.datasets import mnist
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.utils import np_utils

X_train, y_train, X_test, y_test = mnist.load_data()

plt.subplot(221)
plt.imshow(X_train[0], cmap=plt.get_cmap('gray'))
plt.subplot(222)
plt.imshow(X_train[1], cmap=plt.get_cmap('gray'))
plt.subplot(223)
plt.imshow(X_train[2], cmap=plt.get_cmap('gray'))
plt.subplot(224)
plt.imshow(X_train[3], cmap=plt.get_cmap('gray'))
# show the plot
plt.show()