我正在使用 opentok 并连接到广播服务并在页面底部获取 Flash 播放器的对象。
我怎样才能把它放在一个特定的div..
这是我用来连接到 opentol API 的代码
function initiatecall() {
if (session != undefined) {
if (!iscalled) {
session.addEventListener("sessionConnected", sessionConnectedHandler);
session.addEventListener("streamCreated", streamCreatedHandler);
session.connect("21457612", token_id); // Replace with your API key and token. See https://dashboard.tokbox.com/projects
// and https://dashboard.tokbox.com/projects
iscalled = true;
$.ajax({
data: '{"ChatId":"' + chat_id + '","NurseId":"' + nurse_id + '","DeviceType":"Browser"}',
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
url: "someurl.asmx/MakeCall",
success: function (data) { initiatecall(chat_id, session_id, token_id); },
eror: function (a, b, c) { alert(a.responseText); }
});
}
} else {
alert("Session Expired!!");
}
}
function sessionConnectedHandler(event) {
subscribeToStreams(event.streams);
session.publish();
}
function streamCreatedHandler(event) {
subscribeToStreams(event.streams);
}
function subscribeToStreams(streams) {
for (i = 0; i < streams.length; i++) {
var stream = streams[i];
if (stream.connection.connectionId != session.connection.connectionId) {
session.subscribe(stream);
}
}
}
function exceptionHandler(event) {
alert("Exception: " + event.code + "::" + event.message);
}
</script>
<!--End of code-->
<!--Signal R-->
<script type="text/javascript">
$(function () {
//$.hubConnection.app.MapHubs(new HubConfiguration { EnableCrossDomain = true });
// Proxy created on the fly
var chat = $.connection.chat
//var chat = $.connection.WebPushNotification;
//alert(chat);
// Start the connection
// $.connection.hub.start();
//port 1935
$.connection.hub.start({ transport: 'auto' }, function () {
//alert('connected');
$("#info").append("<br/>Hub Started..");
initiatecall();
$("#info").append("<br/>Call Initiated..");
chat.send(chat_id + ',' + session_id + ',' + token_id + ',' + '<%=Session["UserId"].ToString() %>');
$("#info").append("<br/>Broadcasted Message..");
//$('#MainContent_connected').text('Connected to chat room');
});
// Declare a function on the chat hub so the server can invoke it
chat.addMessage = function (message) {
//alert(message);
//$('#messages').append('<li>' + message + '</li>');
};
});
</script>
我采取了一个 div 来显示所有进度。
<div id="info">
</div>
它将我连接到我的视频并请求许可,但它占据了自己的位置,而不是根据我的设计。