2.0.272 • Published 10 days ago

@flashphoner/sfusdk v2.0.272

Weekly downloads
-
License
MIT
Repository
-
Last release
10 days ago

@flashphoner/sfusdk

Flashphoner WebCallServer SFU JavaScript API (SFU SDK)

Flashphoner WebCallServer SFU JavaScript API (SFU SDK) implementation.

Install

npm install @flashphoner/sfusdk

Usage example

import React, {useState} from "react";
import * as SFU from '@flashphoner/sfusdk/src/sdk/sfu.js'
import * as Constants from '@flashphoner/sfusdk/src/sdk/constants.js'

export default function TestApp() {
    const [url, setUrl] = useState("ws://localhost:8080");
    const [established, setEstablished] = useState("Not connected");
    const [buttonText, setButtonText] = useState("Connect");
    const [session, setSession] = useState(null);

    function onClick() {
        if (session == null) {
            console.log("Trying to connect");
            const pc = new RTCPeerConnection();
            const s = SFU.createRoom({
                url: url,
                roomName: "ROOM",
                pin: "1234",
                nickname: "Test",
                pc: pc
            }).on(Constants.SFU_EVENT.CONNECTED, (room) => {
                console.log("Connected!");
                setEstablished("Connected!");
                setButtonText("Disconnect");
                setSession(s);
                room.join();
            }).on(Constants.SFU_EVENT.DISCONNECTED, () => {
                console.log("Disconnected!");
                setEstablished("Not connected!");
                setButtonText("Connect");
                setSession(null);
            });
        } else {
            let room = session.room();
            if(room) {
                room.destroyRoom()
            }
            session.disconnect();            
        }
    }

    return(
        <div>
            <div>
                <input type="text" value={url} placeholder="Enter server websocket URL" onChange={(e) => setUrl(e.target.value)}/>
                <button onClick={() => onClick()}>{buttonText}</button>
            </div>
            <div>{established}</div>
        </div>
        
    )
}

Building browserified JS bundle

Install grunt (if this is not installed)

npm install grunt

Build

grunt build

Deploy to web server

mkdir -p /var/www/html/flashphoner-sfu-test
cp -r out/* /var/www/html/flashphoner-sfu-test

Documentation

SFU functions description SFU SDK documentation SFU client example description API documentation

Known issues

SFU SDK is built 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.272

10 days ago

2.0.271

1 month ago

2.0.270

2 months ago

2.0.269

3 months ago

2.0.268

3 months ago

2.0.264

4 months ago

2.0.263

4 months ago

2.0.262

5 months ago

2.0.261

5 months ago

2.0.258

5 months ago

2.0.257

5 months ago

2.0.256

6 months ago

2.0.255

6 months ago

2.0.250

7 months ago

2.0.249

7 months ago

2.0.248

7 months ago

2.0.244

9 months ago

2.0.243

9 months ago

2.0.242

10 months ago

2.0.240

10 months ago

2.0.239

11 months ago

2.0.238

11 months ago

2.0.236

11 months ago

2.0.234

11 months ago

2.0.233

11 months ago

2.0.216

1 year ago

2.0.214

1 year ago

2.0.212

1 year ago

2.0.210

1 year ago

2.0.228

12 months ago

2.0.226

12 months ago

2.0.221

1 year ago

2.0.220

1 year ago

2.0.231

11 months ago

2.0.198

1 year ago

2.0.230

12 months ago

2.0.206

1 year ago

2.0.203

1 year ago

2.0.202

1 year ago

2.0.201

1 year ago

2.0.200

1 year ago

2.0.196

1 year ago

2.0.193

1 year ago

2.0.189

1 year ago

2.0.188

1 year ago

2.0.190

1 year ago

2.0.192

1 year ago

2.0.137

1 year ago

2.0.136

1 year ago

2.0.179

1 year ago

2.0.135

1 year ago

2.0.132

1 year ago

2.0.131

2 years ago

2.0.130

2 years ago

2.0.186

1 year ago

2.0.185

1 year ago

2.0.155

1 year ago

2.0.129

2 years ago

2.0.128

2 years ago

2.0.126

2 years ago

2.0.118

2 years ago

2.0.117

2 years ago

2.0.116

2 years ago

2.0.124

2 years ago

2.0.123

2 years ago

2.0.99

2 years ago

2.0.77

2 years ago

2.0.78

2 years ago

2.0.97

2 years ago

2.0.98

2 years ago

2.0.76

2 years ago

2.0.95

2 years ago

2.0.96

2 years ago

2.0.92

2 years ago

2.0.90

2 years ago

2.0.107

2 years ago

2.0.88

2 years ago

2.0.89

2 years ago

2.0.87

2 years ago

2.0.82

2 years ago

2.0.81

2 years ago

2.0.75

2 years ago

2.0.74

2 years ago

2.0.71

2 years ago

2.0.72

2 years ago

2.0.70

2 years ago

2.0.69

2 years ago

2.0.68

2 years ago

2.0.66

2 years ago

2.0.65

2 years ago

2.0.59

2 years ago

2.0.48

2 years ago

2.0.57

2 years ago

2.0.56

2 years ago

2.0.53

2 years ago

2.0.54

2 years ago

2.0.51

2 years ago

2.0.61

2 years ago

2.0.50

2 years ago

1.0.43

2 years ago

1.0.47

2 years ago

1.0.40

2 years ago

1.0.1-37

2 years ago

1.0.1-36

2 years ago

1.0.1-35

2 years ago

1.0.1-34

2 years ago

1.0.1-32

2 years ago

1.0.41

2 years ago

1.0.1-31

2 years ago

1.0.1-30

3 years ago