PHPackages                             squareetlabs/laravel-openvidu - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. squareetlabs/laravel-openvidu

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

squareetlabs/laravel-openvidu
=============================

Laravel client for controlling your videocalls from your Openvidu server.

1.21(4y ago)2710.8k11[1 issues](https://github.com/squareetlabs/LaravelOpenVidu/issues)MITPHPPHP &gt;=7.2.5

Since Dec 2Pushed 4y ago4 watchersCompare

[ Source](https://github.com/squareetlabs/LaravelOpenVidu)[ Packagist](https://packagist.org/packages/squareetlabs/laravel-openvidu)[ Docs](https://github.com/squareetlabs/laravel-openvidu)[ RSS](/packages/squareetlabs-laravel-openvidu/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (11)Versions (24)Used By (0)

Laravel client for controlling your videocalls from your Openvidu server.
=========================================================================

[](#laravel-client-for-controlling-your-videocalls-from-your-openvidu-server)

[![Quality Score](https://camo.githubusercontent.com/85bb5a917e66ab660447d22d0de83cfeeec1427579c6794e80da8e59fb97cf0d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73717561726565746c6162732f4c61726176656c4f70656e566964752f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/squareetlabs/LaravelOpenVidu/)[![Build Status](https://camo.githubusercontent.com/135957ea07cf6d96963d443616590fda6cbc7c93c70b5e034a18fd7586eb87d7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73717561726565746c6162732f4c61726176656c4f70656e566964752f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/squareetlabs/LaravelOpenVidu/)[![Code Intelligence](https://camo.githubusercontent.com/4b22a887f12337e31103c24a0e0f99371b48349be98a9fe38e51cf2ca3f36bc2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73717561726565746c6162732f4c61726176656c4f70656e566964752f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/g/squareetlabs/LaravelOpenVidu/)[![Latest Stable Version](https://camo.githubusercontent.com/bae81e5f2ac178e6e9a5b7323b04fb788e5074a4b0591000e18ae2c2761b29dc/68747470733a2f2f706f7365722e707567782e6f72672f73717561726565746c6162732f6c61726176656c2d6f70656e766964752f762f737461626c65)](https://packagist.org/packages/squareetlabs/laravel-openvidu)[![Total Downloads](https://camo.githubusercontent.com/c198100f35034749f2ee1723901c3c73cfe120d100c564d2dd8aef8297a0403d/68747470733a2f2f706f7365722e707567782e6f72672f73717561726565746c6162732f6c61726176656c2d6f70656e766964752f646f776e6c6f616473)](https://packagist.org/packages/squareetlabs/laravel-openvidu) [![License](https://camo.githubusercontent.com/0903399eb032c4f2b646b55a6e90e444b318e67a9137769d6d1306cd6e49465c/68747470733a2f2f706f7365722e707567782e6f72672f73717561726565746c6162732f6c61726176656c2d6f70656e766964752f6c6963656e7365)](https://packagist.org/packages/squareetlabs/laravel-openvidu)

### This is a Laravel package wrapping OpenVidu Server REST API

[](#this-is-a-laravel-package-wrapping-openvidu-server-rest-api)

Installation
------------

[](#installation)

You can install this package via composer:

```
composer require squareetlabs/laravel-openvidu
```

### Add Service Provider &amp; Facade

[](#add-service-provider--facade)

#### For Laravel 5.5+

[](#for-laravel-55)

Once the package is added, the service provider and facade will be autodiscovered.

#### For Older versions of Laravel

[](#for-older-versions-of-laravel)

Add the ServiceProvider to the providers array in `config/app.php`:

```
SquareetLabs\LaravelOpenVidu\Providers\OpenViduServiceProvider::class;
```

Add the Facade to the aliases array in `config/app.php`:

```
'OpenVidu' => SquareetLabs\LaravelOpenVidu\Facades\LaravelOpenVidu::class;
```

### Run migrations

[](#run-migrations)

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

Add your OpenVidu Server configuration values to your `config/services.php` file:

```
return [
    ...
    'openvidu' => [
           'app' => env('OPENVIDU_APP'), //At the moment, always "OPENVIDUAPP"
           'domain' => env('OPENVIDU_DOMAIN'), //Your OpenVidu Server machine public IP
           'port' => env('OPENVIDU_PORT'), //Listening port of your OpenVidu server, default 4443
           'secret' => env('OPENVIDU_SECRET'), //The password used to secure your OpenVidu Server
           'debug' => env('OPENVIDU_DEBUG'), // true or false
           'use_routes' => env('OPENVIDU_USE_ROUTES') // true or false
       ]
    ...
```

Set `debug` to `true` if you want to debug OpenVidu API consumptions from Guzzle Client

Set `use_routes` to `false` if you don't want to use default defined routes.

You must also add the openvidu cache driver to your `config/cache.php` file:

```
return [
    'stores' => [
            ...
            'openvidu' => [
                   'driver' => 'openvidu',
                   'table' => 'openvidu_cache'
               ]
    ]
    ...
```

Usage
-----

[](#usage)

### Using endpoints

[](#using-endpoints)

##### LaravelOpenVidu is very easy to use. By default it exposes 13 different endpoints.

[](#laravelopenvidu-is-very-easy-to-use-by-default-it-exposes-13-different-endpoints)

###### 1- Create a token for a new session or an existing session

[](#1--create-a-token-for-a-new-session-or-an-existing-session)

```
---------------------------------------------------------------------------------
Method:         POST
---------------------------------------------------------------------------------
Route name:     openvidu.token
---------------------------------------------------------------------------------
Uri:            openvidu/token
---------------------------------------------------------------------------------
Body:           {
                    "session":{
                       "mediaMode":"MEDIA_MODE",
                       "recordingMode":"RECORDING_MODE",
                       "customSessionId":"CUSTOM_SESSION_ID",
                       "defaultOutputMode":"OUTPUT_MODE",
                       "defaultRecordingLayout":"RECORDING_LAYOUT",
                       "defaultCustomLayout":"CUSTOM_LAYOUT"
                    },
                    "tokenOptions":{
                       "role":"ROLE",
                       "data":"DATA"
                    }
                 }
---------------------------------------------------------------------------------
Sample return:
                 {
                    "token":{
                       "id":"wss://squareet.com:4443?sessionId=zfgmthb8jl9uellk&token=lnlrtnkwm4v8l7uc&role=PUBLISHER&turnUsername=FYYNRC&turnCredential=yfxxs3",
                       "session":"zfgmthb8jl9uellk",
                       "role":"PUBLISHER",
                       "data":"User Data",
                       "token":"wss://squareet.com:4443?sessionId=zfgmthb8jl9uellk&token=lnlrtnkwm4v8l7uc&role=PUBLISHER&turnUsername=FYYNRC&turnCredential=yfxxs3",
                       "kurentoOptions":{
                          "videoMaxSendBandwidth":700,
                          "allowedFilters":[
                             "GStreamerFilter",
                             "ZBarFilter"
                          ]
                       }
                    }
                }
```

###### 2- Get an existing session from array stored in memory

[](#2--get-an-existing-session-from-array-stored-in-memory)

```
---------------------------------------------------------------------------------
Method:         GET|HEAD
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}
---------------------------------------------------------------------------------
Sample return:
                {
                   "session":{
                      "sessionId":"TestSession",
                      "createdAt":1538482606338,
                      "mediaMode":"ROUTED",
                      "recordingMode":"MANUAL",
                      "defaultOutputMode":"COMPOSED",
                      "defaultRecordingLayout":"BEST_FIT",
                      "customSessionId":"TestSession",
                      "connections":{
                         "numberOfElements":2,
                         "content":[
                            {
                               "connectionId":"vhdxz7abbfirh2lh",
                               "createdAt":1538482606412,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=2ezkertrimk6nttk&role=PUBLISHER&turnUsername=H0EQLL&turnCredential=kjh48u",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient1",
                               "publishers":[
                                  {
                                     "createdAt":1538482606976,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "mediaOptions":{
                                        "hasAudio":true,
                                        "audioActive":true,
                                        "hasVideo":true,
                                        "videoActive":true,
                                        "typeOfVideo":"CAMERA",
                                        "frameRate":30,
                                        "videoDimensions":"{\"width\":640,\"height\":480}",
                                        "filter":{

                                        }
                                     }
                                  }
                               ],
                               "subscribers":[

                               ]
                            },
                            {
                               "connectionId":"maxawd3ysuj1rxvq",
                               "createdAt":1538482607659,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=ovj1b4ysuqmcirti&role=PUBLISHER&turnUsername=INOAHN&turnCredential=oujrqd",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient2",
                               "publishers":[

                               ],
                               "subscribers":[
                                  {
                                     "createdAt":1538482607799,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "publisher":"vhdxz7abbfirh2lh"
                                  }
                               ]
                            }
                         ]
                      },
                      "recording":false
                   }
               }
```

###### 3- Get an existing session from OpenVidu Server

[](#3--get-an-existing-session-from-openvidu-server)

```
---------------------------------------------------------------------------------
Method:         GET|HEAD
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.fetch
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/fetch
---------------------------------------------------------------------------------
Sample return:
                {
                   "session":{
                      "sessionId":"TestSession",
                      "createdAt":1538482606338,
                      "mediaMode":"ROUTED",
                      "recordingMode":"MANUAL",
                      "defaultOutputMode":"COMPOSED",
                      "defaultRecordingLayout":"BEST_FIT",
                      "customSessionId":"TestSession",
                      "connections":{
                         "numberOfElements":2,
                         "content":[
                            {
                               "connectionId":"vhdxz7abbfirh2lh",
                               "createdAt":1538482606412,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=2ezkertrimk6nttk&role=PUBLISHER&turnUsername=H0EQLL&turnCredential=kjh48u",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient1",
                               "publishers":[
                                  {
                                     "createdAt":1538482606976,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "mediaOptions":{
                                        "hasAudio":true,
                                        "audioActive":true,
                                        "hasVideo":true,
                                        "videoActive":true,
                                        "typeOfVideo":"CAMERA",
                                        "frameRate":30,
                                        "videoDimensions":"{\"width\":640,\"height\":480}",
                                        "filter":{

                                        }
                                     }
                                  }
                               ],
                               "subscribers":[

                               ]
                            },
                            {
                               "connectionId":"maxawd3ysuj1rxvq",
                               "createdAt":1538482607659,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=ovj1b4ysuqmcirti&role=PUBLISHER&turnUsername=INOAHN&turnCredential=oujrqd",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient2",
                               "publishers":[

                               ],
                               "subscribers":[
                                  {
                                     "createdAt":1538482607799,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "publisher":"vhdxz7abbfirh2lh"
                                  }
                               ]
                            }
                         ]
                      },
                      "recording":false
                   }
               }
```

###### 4- Returns the list of active sessions

[](#4--returns-the-list-of-active-sessions)

```
---------------------------------------------------------------------------------
Method:         GET|HEAD
---------------------------------------------------------------------------------
Route name:     openvidu.sessions
---------------------------------------------------------------------------------
Uri:            openvidu/sessions
---------------------------------------------------------------------------------
Sample return:
                {
                    'sessions' : [
                      "sessionId":"TestSession",
                      "createdAt":1538482606338,
                      "mediaMode":"ROUTED",
                      "recordingMode":"MANUAL",
                      "defaultOutputMode":"COMPOSED",
                      "defaultRecordingLayout":"BEST_FIT",
                      "customSessionId":"TestSession",
                      "connections":{
                         "numberOfElements":2,
                         "content":[
                            {
                               "connectionId":"vhdxz7abbfirh2lh",
                               "createdAt":1538482606412,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=2ezkertrimk6nttk&role=PUBLISHER&turnUsername=H0EQLL&turnCredential=kjh48u",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient1",
                               "publishers":[
                                  {
                                     "createdAt":1538482606976,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "mediaOptions":{
                                        "hasAudio":true,
                                        "audioActive":true,
                                        "hasVideo":true,
                                        "videoActive":true,
                                        "typeOfVideo":"CAMERA",
                                        "frameRate":30,
                                        "videoDimensions":"{\"width\":640,\"height\":480}",
                                        "filter":{

                                        }
                                     }
                                  }
                               ],
                               "subscribers":[

                               ]
                            },
                            {
                               "connectionId":"maxawd3ysuj1rxvq",
                               "createdAt":1538482607659,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=ovj1b4ysuqmcirti&role=PUBLISHER&turnUsername=INOAHN&turnCredential=oujrqd",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient2",
                               "publishers":[

                               ],
                               "subscribers":[
                                  {
                                     "createdAt":1538482607799,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "publisher":"vhdxz7abbfirh2lh"
                                  }
                               ]
                            }
                         ]
                      },
                      "recording":false
                   },
                    {
                      "sessionId":"TestSession2",
                      "createdAt":1538482606438,
                      "mediaMode":"ROUTED",
                      "recordingMode":"MANUAL",
                      "defaultOutputMode":"COMPOSED",
                      "defaultRecordingLayout":"BEST_FIT",
                      "customSessionId":"TestSession2",
                      "connections":{
                         "numberOfElements":2,
                         "content":[
                            {
                               "connectionId":"vhdxz7abbfirh2lh",
                               "createdAt":1538482606448,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=2ezkertrimk6nttk&role=PUBLISHER&turnUsername=H0EQLL&turnCredential=kjh48u",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient2",
                               "publishers":[
                                  {
                                     "createdAt":1538482606976,
                                     "streamId":"vhdxz7abbfiras_CAMERA_VAU",
                                     "mediaOptions":{
                                        "hasAudio":true,
                                        "audioActive":true,
                                        "hasVideo":true,
                                        "videoActive":true,
                                        "typeOfVideo":"CAMERA",
                                        "frameRate":30,
                                        "videoDimensions":"{\"width\":640,\"height\":480}",
                                        "filter":{

                                        }
                                     }
                                  }
                               ],
                               "subscribers":[

                               ]
                            },
                            {
                               "connectionId":"ssaxlfaslmcklasdcas",
                               "createdAt":1538482432559,
                               "location":"",
                               "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                               "token":"wss://localhost:4443?sessionId=TestSession&token=ovj1b4ysuqmcirti&role=PUBLISHER&turnUsername=INOAHN&turnCredential=oujrqd",
                               "role":"PUBLISHER",
                               "serverData":"",
                               "clientData":"TestClient3",
                               "publishers":[

                               ],
                               "subscribers":[
                                  {
                                     "createdAt":1538482607799,
                                     "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                                     "publisher":"vhdxz7abbfirh2lh"
                                  }
                               ]
                            }
                         ]
                      },
                      "recording":false
                   }
               }]
                 }

```

###### 5- Returns the list of active connections to the session

[](#5--returns-the-list-of-active-connections-to-the-session)

```
---------------------------------------------------------------------------------
Method:         GET|HEAD
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.connections
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/connections
---------------------------------------------------------------------------------
Sample return:
                [
                    {
                       "connectionId":"vhdxz7abbfirh2lh",
                       "createdAt":1538482606412,
                       "location":"",
                       "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                       "token":"wss://localhost:4443?sessionId=TestSession&token=2ezkertrimk6nttk&role=PUBLISHER&turnUsername=H0EQLL&turnCredential=kjh48u",
                       "role":"PUBLISHER",
                       "serverData":"",
                       "clientData":"TestClient1",
                       "publishers":[
                          {
                             "createdAt":1538482606976,
                             "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                             "mediaOptions":{
                                "hasAudio":true,
                                "audioActive":true,
                                "hasVideo":true,
                                "videoActive":true,
                                "typeOfVideo":"CAMERA",
                                "frameRate":30,
                                "videoDimensions":"{\"width\":640,\"height\":480}",
                                "filter":{

                                }
                             }
                          }
                       ],
                       "subscribers":[

                       ]
                    },
                    {
                       "connectionId":"maxawd3ysuj1rxvq",
                       "createdAt":1538482607659,
                       "location":"",
                       "platform":"Chrome 69.0.3497.100 on Linux 64-bit",
                       "token":"wss://localhost:4443?sessionId=TestSession&token=ovj1b4ysuqmcirti&role=PUBLISHER&turnUsername=INOAHN&turnCredential=oujrqd",
                       "role":"PUBLISHER",
                       "serverData":"",
                       "clientData":"TestClient2",
                       "publishers":[

                       ],
                       "subscribers":[
                          {
                             "createdAt":1538482607799,
                             "streamId":"vhdxz7abbfirh2lh_CAMERA_CLVAU",
                             "publisher":"vhdxz7abbfirh2lh"
                          }
                       ]
                    }
                 ]

```

###### 6- Allows publish a Stream (For now can only be IPCAM).

[](#6---allows-publish-a-stream-for-now-can-only-be-ipcam)

```
---------------------------------------------------------------------------------
Method:         POST
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.publish
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/publish
---------------------------------------------------------------------------------
Body:           {
                   "rtspUri":"rtsp://check.squareet.com:1935/live/sys3.stream",
                   "type":"IPCAM",
                   "adaptativeBitrate":true,
                   "onlyPlayWithSubscribers":true,
                   "data":"Reception room"
                 }
---------------------------------------------------------------------------------
Sample return:
                 {
                    "connection: {
                       "connectionId":"ipc_IPCAM_rtsp_A8MJ_91_191_213_49_554_live_mpeg4_sdp",
                       "createdAt":1538482432559,
                       "location":"unknown",
                       "platform":"IPCAM",
                       "token":undefined,
                       "role":"PUBLISHER",
                       "serverData":"Reception room",

                       "publishers":[
                         {
                            "createdAt":1582121476439,
                            "streamId":"str_IPC_XC1W_ipc_IPCAM_rtsp_A8MJ_91_191_213_49_554_live_mpeg4_sdp",
                            "rtspUri":"rtsp://91.191.213.49:554/live_mpeg4.sdp",
                            "mediaOptions":{
                               "hasAudio":true,
                               "audioActive":true,
                               "hasVideo":true,
                               "videoActive":true,
                               "typeOfVideo":"IPCAM",
                               "frameRate":null,
                               "videoDimensions":null,
                               "filter":{

                               },
                               "adaptativeBitrate":true,
                               "onlyPlayWithSubscribers":true
                            }
                         }
                      ],
                      "subscribers":[

                      ]
                    }
                }

```

###### 7- Forces some user to unpublish a Stream.

[](#7--forces-some-user-to-unpublish-a-stream)

```
---------------------------------------------------------------------------------
Method:         DELETE
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.forceUnpublish
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/forceUnpublish/{streamId}
---------------------------------------------------------------------------------
Sample return: 'unpublished': true

```

###### 8- Forces the user with connectionId to leave the session

[](#8--forces-the-user-with-connectionid-to-leave-the-session)

```
---------------------------------------------------------------------------------
Method:         DELETE
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.forceDisconnect
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/forceDisconnect/{connectionId}
---------------------------------------------------------------------------------
Sample return: 'disconnected': true

```

###### 9- Gracefully closes the Session: unpublish all streams and evicts every

[](#9--gracefully-closes-the-session-unpublish-all-streams-and-evicts-every)

```
---------------------------------------------------------------------------------
Method:         PATCH
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.close
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/close
---------------------------------------------------------------------------------
Sample return:  'closed': true

```

###### 10- Checks if a session is being recorded

[](#10--checks-if-a-session-is-being-recorded)

```
---------------------------------------------------------------------------------
Method:         GET|HEAD
---------------------------------------------------------------------------------
Route name:     openvidu.sessions.session.isBeingRecording
---------------------------------------------------------------------------------
Uri:            openvidu/session/{sessionId}/isBeingRecording
---------------------------------------------------------------------------------
Sample return:  'isBeingRecording': true

```

###### 11- Start recording a session

[](#11--start-recording-a-session)

```
---------------------------------------------------------------------------------
Method:         POST
---------------------------------------------------------------------------------
Route name:     openvidu.recording.start
---------------------------------------------------------------------------------
Uri:            openvidu/recording
---------------------------------------------------------------------------------
Body:
                {
                   "session":"SESSION_ID",
                   "name":"NAME",
                   "outputMode":"OUTPUT_MODE",
                   "hasAudio":"HAS_AUDIO",
                   "hasVideo":"HAS_VIDEO",
                   "resolution":"RESOLUTION",
                   "recordingLayout":"RECORDING_LAYOUT",
                   "customLayout":"CUSTOM_LAYOUT"
                }
---------------------------------------------------------------------------------
Sample return:
                {
                    "recording":{
                      "id":"fds4e07mdug1ga3h",
                      "sessionId":"fds4e07mdug1ga3h",
                      "name":"MyRecording",
                      "outputMode":"COMPOSED",
                      "hasAudio":true,
                      "hasVideo":false,
                      "createdAt":1538483606521,
                      "size":3205004,
                      "duration":12.92,
                      "url":null,
                      "status":"started"
                    }
                }
```

###### 12- Stop recording a session

[](#12--stop-recording-a-session)

```
---------------------------------------------------------------------------------
Method:         POST
---------------------------------------------------------------------------------
Route name:     openvidu.recording.stop
---------------------------------------------------------------------------------
Uri:            openvidu/recording/{recordingId}
---------------------------------------------------------------------------------
Sample return:
                {
                    "recording":{
                        "id":"fds4e07mdug1ga3h",
                        "sessionId":"fds4e07mdug1ga3h",
                        "name":"MyRecording",
                        "outputMode":"COMPOSED",
                        "hasAudio":true,
                        "hasVideo":false,
                        "createdAt":1538483606521,
                        "size":3205004,
                        "duration":12.92,
                        "url":null,
                        "status":"stopped"
                    }
                }
```

###### 13- Get the recording of a session

[](#13--get-the-recording-of-a-session)

```
---------------------------------------------------------------------------------
Method:         GET|HEAD
---------------------------------------------------------------------------------
Route name:     openvidu.recording
---------------------------------------------------------------------------------
Uri:            openvidu/recording/{recordingId}
---------------------------------------------------------------------------------
Sample return:
                {
                   "recording":{
                       "id":"fds4e07mdug1ga3h",
                       "sessionId":"fds4e07mdug1ga3h",
                       "name":"MyRecording",
                       "outputMode":"COMPOSED",
                       "hasAudio":true,
                       "hasVideo":false,
                       "createdAt":1538483606521,
                       "size":3205004,
                       "duration":12.92,
                       "url":"https://squareet/recordings/{recordingId}/{name}.extension,
                       "status":"available"
                   }
               }

```

###### 14- Delete the recording of a session

[](#14--delete-the-recording-of-a-session)

```
---------------------------------------------------------------------------------
Method:         DELETE
---------------------------------------------------------------------------------
Route name:     openvidu.recording.delete
---------------------------------------------------------------------------------
Uri:            openvidu/recording/{recordingId}
---------------------------------------------------------------------------------
Returns nothing
```

###### 15- Sends signal to session

[](#15--sends-signal-to-session)

```
---------------------------------------------------------------------------------
Method:         POST
---------------------------------------------------------------------------------
Route name:     openvidu.sendsignal
---------------------------------------------------------------------------------
Uri:            openvidu/sendSignal
---------------------------------------------------------------------------------
Body:
                {
                   "session":"SESSION_ID",
                   "to":["connectionId1", "connectionId2"],
                   "type":"Test type",
                   "data":"This is my signal test data"
                }
---------------------------------------------------------------------------------
Sample return: "sent": true

```

### Using OpenVidu Facade

[](#using-openvidu-facade)

###### Create a token for a new session or an existing session

[](#create-a-token-for-a-new-session-or-an-existing-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\SessionProperties;
use SquareetLabs\LaravelOpenVidu\Enums\MediaMode;
use SquareetLabs\LaravelOpenVidu\Enums\RecordingMode;
use SquareetLabs\LaravelOpenVidu\Enums\OutputMode;
use SquareetLabs\LaravelOpenVidu\Enums\RecordingLayout;
use Illuminate\Support\Str;
...
/** var string */
$customSessionId = Str::random(20);

$sessionProperties = new SessionProperties(MediaMode::ROUTED, RecordingMode::MANUAL, OutputMode::COMPOSED, RecordingLayout::BEST_FIT, $customSessionId);
$session = OpenVidu::createSession($sessionProperties);

$tokenOptions = new TokenOptions(OpenViduRole::PUBLISHER);
$token = $session->generateToken($tokenOptions);
```

###### Get all active session

[](#get-all-active-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = OpenVidu::getActiveSessions();
```

###### Get an existing session

[](#get-an-existing-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = OpenVidu::getSession($customSessionId);
```

###### Get all active connections from session

[](#get-all-active-connections-from-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = $session = OpenVidu::getSession($customSessionId);
$connections = $session->getActiveConnections();
```

###### Close a session

[](#close-a-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = OpenVidu::getSession($customSessionId);
$closed = $session->close();
```

###### Publish a stream on session (For now only can be IPCAM)

[](#publish-a-stream-on-session-for-now-only-can-be-ipcam)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\IPCameraOptions;
...
/** @var string */
$rtspUri = "rtsp://check.squareet.com:1935/live/sys3.stream";
/** @var string */
$type = "IPCAM";
/** @var bool */
$adaptativeBitrate = true;
/** @var bool */
$onlyPlayWithSubscribers = true;
/** @var string */
$data = "Reception room";
$ipCamera = new IPCameraOptions($rtspUri,$type,$adaptativeBitrate,$onlyPlayWithSubscribers,$data);
$session = OpenVidu::getSession($customSessionId);
$connection = $session->publish($ipCamera);
```

###### Forces some user to unpublish a Stream.

[](#forces-some-user-to-unpublish-a-stream)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = OpenVidu::getSession($customSessionId);
$unpublished = $session->forceUnpublish($streamId);
```

###### Forces the user with connectionId to leave the session.

[](#forces-the-user-with-connectionid-to-leave-the-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = OpenVidu::getSession($customSessionId);
$disconnect = $session->forceDisconnect($connectionId);
```

###### Checks if a session is being recorded

[](#checks-if-a-session-is-being-recorded)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
...
$session = OpenVidu::getSession($customSessionId);
$isBeingRecording = $session->isBeingRecording($connectionId);
```

###### Start recording a session

[](#start-recording-a-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\Enums\OutputMode;
use SquareetLabs\LaravelOpenVidu\RecordingProperties;
...
/** @var string */
$recordingName = "Recording of my session";
$recordingProperties = new RecordingProperties($customSessionId, $recordingName, OutputMode::INDIVIDUAL, RecordingLayout::BEST_FIT, '1920x1080', true, true, $customLayout)
$recording = OpenVidu::startRecording($recordingProperties);
```

###### Stop recording a session

[](#stop-recording-a-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\Enums\OutputMode;
...
$recording = OpenVidu::stopRecording($recordingId);
```

###### Get the recording of a session

[](#get-the-recording-of-a-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\Enums\OutputMode;
...
$recording = OpenVidu::getRecording($recordingId);
```

###### Delete the recording of a session

[](#delete-the-recording-of-a-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\Enums\OutputMode;
...
OpenVidu::deleteRecording($recordingId);
```

###### Sends signal to session

[](#sends-signal-to-session)

```
use SquareetLabs\LaravelOpenVidu\Facades\OpenVidu;
use SquareetLabs\LaravelOpenVidu\SignalProperties;
...
/** @var string */
$session = "SESSION_ID";
/** @var array */
$to = ["connectionId1", "connectionId2"];
/** @var string */
$type = "Test type";
/** @var string */
$data = "This is my signal test data";
$signalProperties = new SignalProperties($session,  $data, $type, $to);
$sent = OpenVidu::sendSignal($signalProperties);
```

### Available Events

[](#available-events)

At the moment of raising the OpenVidu server we can indicate multiple [configuration options](https://openvidu.io/docs/reference-docs/openvidu-server-params/), one of them is if we want to use the webhook service to receive events in an endpoint. In our case the default endpoint is *'/openvidu/webhook'*

##### Event `ParticipantJoined` is launched when a user has connected to a session. Example of use:

[](#event-participantjoined-is-launched-when-a-user-has-connected-to-a-session--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\ParticipantJoined;

class ParticipantJoinedListener
{
    /**
     * Handle the event.
     *
     * @param  ParticipantJoined  $event
     * @return void
     */
    public function handle(ParticipantJoined $event)
    {
        $event->sessionId;      // Session for which the event was triggered, a string with the session unique identifier
        $event->timestamp;      // Time when the event was triggered, UTC milliseconds
        $event->participantId;  // Identifier of the participant, a string with the participant unique identifier
        $event->platform;       // Complete description of the platform used by the participant to connect to the session
        $event->clientData;     // Additional data added client side while connecting to Session
        $event->serverData;     // Additional data added server side while generating Token
    }
}
```

##### Event `ParticipantLeft` is launched when a user has left a session. Example of use:

[](#event-participantleft-is-launched-when-a-user-has-left-a-session--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\ParticipantLeft;

class ParticipantLeftListener
{
    /**
     * Handle the event.
     *
     * @param  ParticipantLeft  $event
     * @return void
     */
    public function handle(ParticipantLeft $event)
    {
        $event->sessionId;      // Session for which the event was triggered
        $event->timestamp;      // Time when the event was triggered
        $event->participantId;  // Identifier of the participant
        $event->platform;       // Complete description of the platform used by the participant to connect to the session
        $event->clientData;     // Additional data added client side while connecting to Session
        $event->serverData;     // Additional data added server side while generating Token
        $event->startTime;      // Time when the participant joined the session
        $event->duration;       // Total duration of the participant's connection to the session
        $event->reason;         // How the participant left the session.
    }
}
```

##### Event `RecordingStatusChanged` is launched when the status of a recording has changed. The status may be: started, stopped, ready, failed. Example of use:

[](#event-recordingstatuschanged-is-launched-when-the-status-of-a-recording-has-changed-the-status-may-be-started-stopped-ready-failed--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\RecordingStatusChanged;

class RecordingStatusChangedListener
{
    /**
     * Handle the event.
     *
     * @param  RecordingStatusChanged  $event
     * @return void
     */
    public function handle(RecordingStatusChanged $event)
    {
       $event->sessionId;	    // Session for which the event was triggered
       $event->timestamp;	    // Time when the event was triggered
       $event->startTime;	    // Time when the recording started
       $event->id;	            // Unique identifier of the recording
       $event->name;	        // Name given to the recording file
       $event->outputMode;	    // Output mode of the recording
       $event->hasAudio;	    // Wheter the recording file has audio or not
       $event->hasVideo;	    // Wheter the recording file has video or not
       $event->recordingLayout;	// The type of layout used in the recording. Only defined if outputMode is COMPOSED and hasVideo is true
       $event->resolution;	    // Resolution of the recorded file. Only defined if outputMode is COMPOSED and hasVideo is true
       $event->size;            // The size of the video file. 0 until status is stopped
       $event->duration;	    //  Duration of the video file. 0 until status is stopped
       $event->status;	        // Status of the recording
       $event->reason;	        // Why the recording stopped. Only defined when status is stopped or ready
    }
}
```

##### Event `SessionCreated` is launched when a new session has been created. Example of use:

[](#event-sessioncreated-is-launched-when-a-new-session-has-been-created--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\SessionCreated;

class SessionCreatedListener
{
    /**
     * Handle the event.
     *
     * @param  SessionCreated  $event
     * @return void
     */
    public function handle(SessionCreated $event)
    {
        $event->sessionId; // Session for which the event was triggered
        $event->timestamp; // Time when the event was triggered
    }
}
```

##### Event `SessionDestroyed` is launched when a session has finished. Example of use:

[](#event-sessiondestroyed-is-launched-when-a-session-has-finished--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\SessionDestroyed;

class SessionDestroyedListener
{
    /**
     * Handle the event.
     *
     * @param  SessionCreated  $event
     * @return void
     */
    public function handle(SessionDestroyed $event)
    {
        $event->sessionId;      // Session for which the event was triggered
        $event->timestamp;      // Time when the event was triggered
        $event->startTime;	    // Time when the session started
        $event->duration;	    // Total duration of the session
        $event->reason;	        // Why the session was destroyed
    }
}
```

##### Event `WebRTCConnectionCreated` is launched when a new media stream has been established. Can be an "INBOUND" connection (the user is receiving a stream from a publisher of the session) or an "OUTBOUND" connection (the user is a publishing a stream to the session). Example of use:

[](#event-webrtcconnectioncreated-is-launched-when-a-new-media-stream-has-been-established-can-be-an-inbound-connection-the-user-is-receiving-a-stream-from-a-publisher-of-the-session-or-an-outbound-connection-the-user-is-a-publishing-a-stream-to-the-session--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\WebRTCConnectionCreated;

class WebRTCConnectionCreatedListener
{
    /**
     * Handle the event.
     *
     * @param  WebRTCConnectionCreated  $event
     * @return void
     */
    public function handle(WebRTCConnectionCreated $event)
    {
       $event->sessionId;        // Session for which the event was triggered
       $event->timestamp;        // Time when the event was triggered	UTC milliseconds
       $event->participantId;    // Identifier of the participant
       $event->connection;       // Whether the media connection is an inbound connection (the participant is receiving media from OpenVidu) or an outbound connection (the participant is sending media to OpenVidu)	["INBOUND","OUTBOUND"]
       $event->receivingFrom;    // If connection is "INBOUND", the participant from whom the media stream is being received
       $event->audioEnabled;     // Whether the media connection has negotiated audio or not
       $event->videoEnabled;     // Whether the media connection has negotiated video or not
       $event->videoSource;      // If videoEnabled is true, the type of video that is being transmitted
       $event->videoFramerate;   // If videoEnabled is true, the framerate of the transmitted video
       $event->videoDimensions;  // If videoEnabled is true, the dimensions transmitted video
    }
}
```

##### Event `WebRTCConnectionCreated` is launched when any media stream connection is closed. Example of use:

[](#event-webrtcconnectioncreated-is-launched-when-any-media-stream-connection-is-closed--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\WebRTCConnectionDestroyed;

class WebRTCConnectionDestroyedListener
{
    /**
     * Handle the event.
     *
     * @param  WebRTCConnectionDestroyed  $event
     * @return void
     */
    public function handle(WebRTCConnectionDestroyed $event)
    {
       $event->sessionId;        // Session for which the event was triggered
       $event->timestamp;        // Time when the event was triggered	UTC milliseconds
       $event->participantId;    // Identifier of the participant
       $event->connection;       // Whether the media connection is an inbound connection (the participant is receiving media from OpenVidu) or an outbound connection (the participant is sending media to OpenVidu)	["INBOUND","OUTBOUND"]
       $event->receivingFrom;    // If connection is "INBOUND", the participant from whom the media stream is being received
       $event->audioEnabled;     // Whether the media connection has negotiated audio or not
       $event->videoEnabled;     // Whether the media connection has negotiated video or not
       $event->videoSource;      // If videoEnabled is true, the type of video that is being transmitted
       $event->videoFramerate;   // If videoEnabled is true, the framerate of the transmitted video
       $event->videoDimensions;  // If videoEnabled is true, the dimensions transmitted video
       $event->startTime;        // Time when the media connection was established	UTC milliseconds
       $event->duration;         // Total duration of the media connection	Seconds
       $event->reason;           // How the WebRTC connection was destroyed
    }
}
```

##### Event `FilterEventDispatched` is launched when a filter event has been dispatched. This event can only be triggered if a filter has been applied to a stream and a listener has been added to a specific event offered by the filter. Example of use:

[](#event-filtereventdispatched-is-launched-when-a-filter-event-has-been-dispatched-this-event-can-only-be-triggered-if-a-filter-has-been-applied-to-a-stream-and-a-listener-has-been-added-to-a-specific-event-offered-by-the-filter--example-of-use)

```
use SquareetLabs\LaravelOpenVidu\Events\FilterEventDispatched;

class FilterEventDispatchedListener
{
    /**
     * Handle the event.
     *
     * @param  FilterEventDispatched  $event
     * @return void
     */
    public function handle(FilterEventDispatched $event)
    {
        $event->sessionId;      // Session for which the event was triggered
        $event->timestamp;      // Time when the event was triggered
        $event->participantId;	// Identifier of the participant
        $event->streamId;	    // Identifier of the stream for which the filter is applied
        $event->filterType;	    // Type of the filter applied to the stream
        $event->data;	        // Data of the filter event
    }
}
```

Finally remember to add them to your `EventServiceProvider`:

```
protected $listen = [
        ...
        'SquareetLabs\LaravelOpenVidu\Events\ParticipantJoined' => [
            'App\Listeners\ParticipantJoinedListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\ParticipantLeft' => [
            'App\Listeners\ParticipantLeftListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\RecordingStatusChanged' => [
            'App\Listeners\RecordingStatusChangedListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\SessionCreated' => [
            'App\Listeners\SessionCreatedListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\SessionDestroyed' => [
            'App\Listeners\SessionDestroyedListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\WebRTCConnectionCreated' => [
            'App\Listeners\WebRTCConnectionCreatedListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\WebRTCConnectionDestroyed' => [
            'App\Listeners\WebRTCConnectionDestroyedListener',
        ],
        'SquareetLabs\LaravelOpenVidu\Events\FilterEventDispatched' => [
            'App\Listeners\FilterEventDispatchedListener',
        ],
        ...
    ];
```

OpenVidu
--------

[](#openvidu)

Visit [OpenVidu Documentation](https://openvidu.io/docs/home/) for more information.

Support
-------

[](#support)

Feel free to post your issues in the issues section.

Credits
-------

[](#credits)

- [Alberto Rial Barreiro](https://github.com/alberto-rial)
- [Jacobo Cantorna Cigarrán](https://github.com/jcancig)
- [Desarrollo de software a medida](https://www.squareet.com) SquareetLabs
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~107 days

Total

23

Last Release

1616d ago

PHP version history (2 changes)1.0.0PHP ^7.1

1.20PHP &gt;=7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f0312df8043f114ad6f9c945a452d4e451bd14cecae570f9772ce937630bce5?d=identicon)[squareetlabs](/maintainers/squareetlabs)

---

Top Contributors

[![jcancig](https://avatars.githubusercontent.com/u/446610?v=4)](https://github.com/jcancig "jcancig (80 commits)")[![sobolevna](https://avatars.githubusercontent.com/u/12809454?v=4)](https://github.com/sobolevna "sobolevna (11 commits)")[![yigit-serin](https://avatars.githubusercontent.com/u/20225497?v=4)](https://github.com/yigit-serin "yigit-serin (7 commits)")[![MrCrayon](https://avatars.githubusercontent.com/u/6875243?v=4)](https://github.com/MrCrayon "MrCrayon (1 commits)")[![rmundel](https://avatars.githubusercontent.com/u/13142574?v=4)](https://github.com/rmundel "rmundel (1 commits)")

---

Tags

chatkurentolaravel-openviduopenviduroomvideo-conferencingwebrtcchatWebRTCvideoconferenceroomopenvidularavel-openviduvideo-conferencingkurento

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/squareetlabs-laravel-openvidu/health.svg)

```
[![Health](https://phpackages.com/badges/squareetlabs-laravel-openvidu/health.svg)](https://phpackages.com/packages/squareetlabs-laravel-openvidu)
```

###  Alternatives

[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
