Download the PHP package rtippin/janus-client without Composer
On this page you can find all versions of the php package rtippin/janus-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download rtippin/janus-client
More information about rtippin/janus-client
Files in rtippin/janus-client
Download rtippin/janus-client
More information about rtippin/janus-client
Files in rtippin/janus-client
Vendor rtippin
Package janus-client
Short Description Janus Gateway Client
License MIT
Homepage https://github.com/rtippin/janus-client
Package janus-client
Short Description Janus Gateway Client
License MIT
Homepage https://github.com/rtippin/janus-client
Please rate this library. Is it a good library?
Informations about the package janus-client
Laravel Janus Gateway Client
This package provides a client to fluently interact with your Janus Gateway Server
Prerequisites
Laravel | PHP | janus-client |
---|---|---|
8.x |
^7.4 ^8.0 ^8.1 |
<= 1.0.0 |
9.x |
^8.0.2 ^8.1 |
>= 1.1.0 |
10.x |
^8.1 ^8.2 |
>= 1.2.0 |
11.x |
^8.2 ^8.3 |
>= 1.3.0 |
Included
- Core REST API wrapper to interact with janus.
- VideoRoom plugin wrapper.
Fluent, convenient, clean.
Installation
Via Composer
Publish the config file
Config
server_endpoint
is the main HTTP endpoint for your janus server.admin_server_endpoint
is the admin HTTP endpoint for your janus server.verify_ssl
enables or disables ourGuzzle HTTP
calls from verifying the SSL.debug
When enabled, each request in a cycle will dump the payload and responses.admin_secret
API secret to access the admin endpoint.api_secret
The general API secret.video_room_secret
Optional video room secret to protect creates.
General Usage
- You may choose to use our provided facade, or dependency injection to access our core
Janus
class.
Notice, Janus
is registered as a singleton. Once you instantiate our class, it will be kept in memory with its current state for that request cycle.
Obtaining the Janus
client
Using Facade
Using Dependency Injection
info()
- Returns the janus server info array.
ping()
- Ping will always return an array (even if an exception is thrown), containing
pong
as true|false, along with server latency.
debug(bool $debug = true)
- Enable debugging/dumps on the fly by calling to the
debug
method onJanus
. This will dump each HTTP call's payload, response, and latency.
connect()
- Connect will initiate a handshake with janus to set our session ID for any following request. This is a fluent method and can be chained.
attach(string $plugin)
- Attach to a janus plugin to set our handle ID. All following API calls in this request cycles will go to this plugin unless you call detach or disconnect. This is a fluent method and can be chained.
detach()
- Detach from the current plugin/handle. This is a fluent method and can be chained.
disconnect()
- Disconnect from janus, destroying our session and handle/plugin. This is a fluent method and can be chained.
message(array $message, $jsep = null)
- Send janus our message. This is usually called once attached to a plugin, and sends commands to janus. This is a fluent method and can be chained.
trickle($candidate)
- Send a trickle candidate to janus. This is a fluent method and can be chained.
server()
- Returns the underlying janus server class, allowing you to set configs, or access current payloads/responses in the cycle.
Example Cycle
- Say we want to obtain a list of video rooms, 4 calls must be made.
- First we connect which sets our session id.
- Then we want to attach to the video room plugin to set our handle id.
- Once attached, we send janus our command message to list rooms.
- If no further calls need to be made, we then disconnect which will reset our session and handle ID's. This also ensures state sessions are not kept in your janus servers memory.
Shared Plugin Methods
All Plugin methods will return the plugin response array from janus directly.
['plugindata']['data']
contents returned.
Examples using VideoRoom
plugin
{JanusPlugin}->withoutDisconnect()
| {JanusPlugin}->disconnect(bool $force = false)
- If you plan to use many commands in one cycle while attached to the same plugin, calling this method will only create one
connect
andattach
call to reuse our session and handle ID's. - When you have completed all individual calls, you must manually call to the parent
Janus
to disconnect, or force it within the current plugin instance, usingdisconnect(true)
. - These are fluent methods and can be chained.
Example video room call to remove all rooms
{JanusPlugin}->getPluginResponse(?string $key = null)
- Get the API response from the last plugin method called.
['plugindata']['data']
contents will be returned.
{JanusPlugin}->getPluginPayload(?string $key = null)
- Get the API payload for the last plugin method called.
Video Room
For full docs relating to the video room plugin and its responses, please check the Official Docs
- You may access the video room plugin through the core
Janus
class/facade, or dependency injection of the coreVideoRoom
class. - Each main janus method completes a full cycle (connect, attach, message, disconnect) unless you specify
withoutDisconnect()
.
Using Facade
Using Dependency Injection
list()
- Returns a list of the available rooms (excluded those configured or created as private rooms).
exists(int $room)
- Check whether a room exists.
create(array $params = [], bool $usePin = true, bool $useSecret = true)
- Create a new video room. By default, we will create a
PIN
andSECRET
for you, as well as set certain properties. Anyparams
you set will override any of our defaults.- We will merge the PIN/SECRET with the returned array from the janus plugin response, so that you may save it if needed.
edit(int $room, array $params, ?string $secret = null)
- Edit the allowed properties of an existing room.
allowed(int $room, string $action, ?array $allowed = null, ?string $secret = null)
- You can configure whether to check tokens or add/remove people who can join a room.
kick(int $room, int $participantID, ?string $secret = null)
- Kick a participant from the room.
listParticipants(int $room)
- Get a list of the participants in a specific room.
listForwarders(int $room, ?string $secret = null)
- Get a list of all the forwarders in a specific room.
destroy(int $room, ?string $secret = null)
- Destroy an existing video room.
moderate(int $room, int $participantID, bool $mute, ?string $mid = null, ?string $secret = null)
- Forcibly mute/unmute any of the media streams sent by participants.
enableRecording(int $room, bool $record, ?string $secret = null)
- Enable or disable recording on all participants while the conference is in progress.
Example Cycle using many methods without disconnecting between them.
Credits - Richard Tippin
License - MIT
Please see the license file for more information.
All versions of janus-client with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2|^8.3
ext-json Version *
guzzlehttp/guzzle Version ^7.3
illuminate/support Version ^11.0
ext-json Version *
guzzlehttp/guzzle Version ^7.3
illuminate/support Version ^11.0
The package rtippin/janus-client contains the following files
Loading the files please wait ....