Official Flashphoner WebCallServer WebSDK package
npm install @flashphoner/websdkFlashphoner WebCallServer JavaScript API (Web SDK) implementation.
HTML
`two-way-streaming.js:
`Javascript
//Constants
var SESSION_STATUS = Flashphoner.constants.SESSION_STATUS;
var STREAM_STATUS = Flashphoner.constants.STREAM_STATUS;
var session;
var stream;
//Init Flashphoner API on page load
function init_api() {
Flashphoner.init({});
publishBtn.onclick = connect;
playBtn.onclick = playStream;
stopBtn.onclick = stopPublish;
}
//Connect to WCS server over websockets
function connect() {
session = Flashphoner.createSession({
urlServer: "wss://demo.flashphoner.com"
}).on(SESSION_STATUS.ESTABLISHED, function(session) {
publishStream(session);
});
}
//Publish stream
function publishStream(session) {
stream = session.createStream({
name: "stream",
display: document.getElementById("publish"),
});
stream.publish();
}
//Playing stream
function playStream() {
session.createStream({
name: "stream",
display: document.getElementById("play"),
}).play();
}
//Stopping stream
function stopPublish() {
stream.stop();
}
``Please look for more examples on GitHub and on this page
Please read the details here and API docs here
WebSDK is build with webrtc/adapter library version not lower than 7.2.6. In this regard, direct use of this library together with WebSDK should be avoided.