1.5.1 • Published 4 months ago

@vonage/js-sframe v1.5.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

@vonage/js-sframe

Provide encryption/decryption features compatible with Vonage sframe-core native package.

Installation

npm i @vonage/js-sframe

Example

Encryption

import { 
    AudioCodec,
    Client, 
    KidType, 
    KeyContentType,
    VideoCodec
} from "@vonage/js-sframe";


async function encryptConnection(
    kid:KidType, 
    key:KeyContentType,
    connection: RTCPeerConnection
) {
    const [sender] = connection.getSenders();
    const client = await Client.create(); 
    await client.setCodecs(AudioCodec.OPUS, VideoCodec.VP8); // Setting codecs is mandatory for Safari.
    await client.setReceiverEncryptionKey(kid, key);
    await client.encrypt(kid, sender);
}

Decryption

import { 
    AudioCodec,
    Client, 
    KidType, 
    KeyContentType,
    VideoCodec
} from "@vonage/js-sframe";


async function decrypt(
    kid:KidType, 
    key:KeyContentType,
    connection: RTCPeerConnection
) {
    const [receiver] = connection.getReceivers();
    const client = await Client.create(); 
    await client.setCodecs(AudioCodec.OPUS, VideoCodec.VP8); // Setting codecs is mandatory for Safari.
    await client.setReceiverEncryptionKey(kid, key);
    await client.decrypt(kid, receiver);
}

Note about safari

@vonage/js-sframe version 1.5.0 added a workaround for this issue, setting codec explicitly is no longer required

@vonage/js-sframe version < 1.5.0 only: Media codecs used could not be automatically known on Safari (WebKit). Therefore, if you want to support Safari (WebKit), you need to explicitly set them. This could be achieve via client.setCodecs method.

Documentation

https://vonage.github.io/embedded-media-processing-docs/js-sframe/1.5.1/

1.5.1

4 months ago

1.5.0

4 months ago

1.4.0

5 months ago

1.3.1

5 months ago

1.3.0

7 months ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago