javascript - OpenTok Api Broadcasted video placement in web page -
i using opentok , connected broadcast service , getting object of flash player @ bottom of page.
how can place in particular div..
this code using connect opentol api
function initiatecall() { if (session != undefined) { if (!iscalled) { session.addeventlistener("sessionconnected", sessionconnectedhandler); session.addeventlistener("streamcreated", streamcreatedhandler); session.connect("21457612", token_id); // replace api key , token. see https://dashboard.tokbox.com/projects // , 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) { (i = 0; < 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 fly var chat = $.connection.chat //var chat = $.connection.webpushnotification; //alert(chat); // start 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 chat room'); }); // declare function on chat hub server can invoke chat.addmessage = function (message) { //alert(message); //$('#messages').append('<li>' + message + '</li>'); }; }); </script>
i have taken div show progress.
<div id="info"> </div>
it connect me videos , ask permission takes own place not according design.
i think should add parameter replaceelementid
, set value div's id should replaced player. example: if want load player inside #container div define div #replaceelementid inside #container replaced player:
<div id="container"> <div id="replaceelementid"></div> </div>
Comments
Post a Comment