The javascript implementation of the CASTO platform.
npm install --save @casto/sdk
const Casto = require('@casto/sdk')
streamer = new Casto({type: "sender"})
const Casto = require('@casto/sdk')
viewer = new Casto({type: "viewer"})
viewer.onSendChannelsList = ({channels}) => {
for (const channel in channels) {
/* Do some stuff for channel list */
button.addEventListener('click', ()=> {
/* media should be a mediaElement for streaming */
media.srcObject = await casto.getChannel(channel.peerId})
})
}
}
- react tutorial
- vue tutorial
- vanilla javascript tutorial
module that send stream to specific serviceId
module that receive channel list of serviceId
and choose stream from the list to view.
service that relays copies of the sender's stream to viewers.
- https://prisms.casto.tv/serviceId=<SERVICE_ID>
- default: https://prisms.casto.tv/serviceId=TESTO
- or run your own relay - https://github.com/castonetwork/prismbuild
create an instance of the Casto Require keys in the
options
object:
type
: type of casto instance. If you want to do a broadcast, setsender
or setviewer
if you want to watch a broadcast.serviceId
: default isTESTO
streamerPeerId
:
start a broadcast by the Casto. Should return a
MediaStream
, which is an object for transfer to the remote.
Should return a
MediaStream
, which is an object that received broadcasting frompeerId
Casto is initiated. Ready to connect to relay nodes.
Successfully connected to a relay node and is ready to start broadcasting.
webRTC peerConnection is 'completed'. currently sending stream to a relay.
webRTC peerConnection is 'closed'.
Casto is initiated. Ready to connect to relay nodes.
Successfully connected to a relay node and is ready to view streams.
webRTC peerConnection is 'closed'.
Retrieved available lists of channels from relay nodes.
Channel is removed.
Channel is added.
Received the updated channel information.
MIT © Casto Network