2.0.258 • Published 10 months ago

@flashphoner/websdk v2.0.258

Weekly downloads
147
License
MIT
Repository
-
Last release
10 months ago

@flashphoner/websdk

Flashphoner WebCallServer JavaScript API (Web SDK)

Flashphoner WebCallServer JavaScript API (Web SDK) implementation.

Install

npm install @flashphoner/websdk

Using prebuild Javascript bundle in browser

two-way-streaming.html:

<!DOCTYPE html>
<html lang="en">
<head> 
    <script type="text/javascript" src="node_modules/@flashphoner/websdk/flashphoner.js"></script> 
    <script type="text/javascript" src="two-way-streaming.js"></script> 
</head>
<body onload="init_api()">
    <div id="publish" style="width:320px;height:240px;border: solid 1px"></div>
    <br/><button id="publishBtn">Publish</button><br/>
    <br/>
    <div id="play" style="width:320px;height:240px;border: solid 1px"></div>
    <br/><button id="playBtn">Play</button><br/>
    <br/>
    <br/><button id="stopBtn">Stop</button><br/>
</body>
</html>

two-way-streaming.js:

//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();
}

More examples

Please look for more examples on GitHub and on this page

Documentation

Please read the details here and API docs here

Known issues

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.

2.0.258

10 months ago

2.0.257

11 months ago

2.0.256

11 months ago

2.0.255

12 months ago

2.0.254

1 year ago

2.0.253

1 year ago

2.0.252

1 year ago

2.0.251

1 year ago

2.0.250

1 year ago

2.0.249

1 year ago

2.0.248

1 year ago

2.0.247

2 years ago

2.0.246

2 years ago

2.0.245

2 years ago

2.0.244

2 years ago

2.0.243

2 years ago

2.0.242

2 years ago

2.0.241

2 years ago

2.0.240

2 years ago

2.0.239

2 years ago

2.0.238

2 years ago

2.0.237

2 years ago

2.0.236

2 years ago

2.0.235

2 years ago

2.0.234

2 years ago

2.0.233

2 years ago

2.0.232

3 years ago

2.0.231

3 years ago

2.0.229

3 years ago

2.0.230

3 years ago

2.0.228

3 years ago

2.0.227

3 years ago

2.0.226

3 years ago

2.0.225

3 years ago

2.0.224

3 years ago

2.0.219

4 years ago

2.0.223

3 years ago

2.0.222

4 years ago

2.0.221

4 years ago

2.0.218

4 years ago

2.0.217

4 years ago

2.0.216

4 years ago

2.0.215

4 years ago

2.0.209

4 years ago

2.0.208

4 years ago

2.0.212

4 years ago

2.0.211

4 years ago

2.0.210

4 years ago

2.0.207

4 years ago

2.0.206

4 years ago

2.0.205

4 years ago

2.0.203

4 years ago

2.0.202

4 years ago

2.0.201

4 years ago

2.0.200

4 years ago

2.0.198

5 years ago

2.0.193

5 years ago

2.0.191

5 years ago

2.0.192

5 years ago

2.0.190

5 years ago

2.0.189

5 years ago

2.0.180

5 years ago

2.0.178

5 years ago

2.0.176

5 years ago

2.0.173

5 years ago

2.0.171

5 years ago

2.0.169

5 years ago

2.0.168

5 years ago

2.0.170

5 years ago

2.0.167

5 years ago

2.0.166

5 years ago

2.0.165

5 years ago

2.0.164

5 years ago

2.0.163

5 years ago

2.0.160

5 years ago