WebRTCConnectionDestroyed   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 124
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 30
c 1
b 0
f 0
dl 0
loc 124
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 3
1
<?php
2
3
namespace SquareetLabs\LaravelOpenVidu\Events;
4
5
6
/**
7
 * Class WebRTCConnectionCreated
8
 * @package SquareetLabs\LaravelOpenVidu\Events
9
 */
10
class WebRTCConnectionDestroyed
11
{
12
13
    /**
14
     * @var string $sessionId
15
     * Session for which the event was triggered
16
     * A string with the session unique identifier
17
     */
18
    public $sessionId;
19
20
    /**
21
     * @var int $timestamp
22
     * Time when the event was triggered
23
     * UTC milliseconds
24
     */
25
    public $timestamp;
26
27
    /**
28
     * @var string $participantId
29
     * Identifier of the participant
30
     * A string with the participant unique identifier
31
     */
32
    public $participantId;
33
34
    /**
35
     * @var int $startTime
36
     * Time when the media connection was established
37
     * UTC milliseconds
38
     */
39
    public $startTime;
40
41
    /**
42
     * @var int $duration
43
     * Total duration of the media connection
44
     * Seconds
45
     */
46
    public $duration;
47
48
    /**
49
     * @var string $connection
50
     * 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)
51
     * ["INBOUND","OUTBOUND"]
52
     */
53
    public $connection;
54
55
    /**
56
     * @var string $receivingFrom
57
     * If connection is "INBOUND", the participant from whom the media stream is being received
58
     * A string with the participant (sender) unique identifier
59
     */
60
    public $receivingFrom;
61
62
    /**
63
     * @var bool $audioEnabled
64
     * Whether the media connection has negotiated audio or not
65
     * [true,false]
66
     */
67
    public $audioEnabled;
68
69
    /**
70
     * @var bool $videoEnabled
71
     * Whether the media connection has negotiated video or not
72
     * [true,false]
73
     */
74
    public $videoEnabled;
75
76
    /**
77
     * @var string $videoSource
78
     * If videoEnabled is true, the type of video that is being transmitted
79
     * ["CAMERA","SCREEN"]
80
     */
81
    public $videoSource;
82
83
    /**
84
     * @var int $videoFramerate
85
     * If videoEnabled is true, the framerate of the transmitted video
86
     * Number of fps
87
     */
88
    public $videoFramerate;
89
90
    /**
91
     * @var int $videoDimensions
92
     * If videoEnabled is true, the dimensions transmitted video
93
     * String with the dimensions (e.g. "1920x1080")
94
     */
95
    public $videoDimensions;
96
97
    /**
98
     * @var  string $reason
99
     * How the WebRTC connection was destroyed
100
     *["unsubscribe","unpublish","disconnect","forceUnpublishByUser","forceUnpublishByServer","forceDisconnectByUser","forceDisconnectByServer","sessionClosedByServer","networkDisconnect","openviduServerStopped","mediaServerDisconnect"]
101
     */
102
    public $reason;
103
104
    /**
105
     * @var string $event
106
     * Openvidu server webhook event
107
     */
108
    public $event;
109
110
111
    /**
112
     * Create a new SessionCreated event instance.
113
     * @param  array  $data
114
     */
115
    public function __construct(array $data)
116
    {
117
        $this->sessionId = $data['sessionId'];
118
        $this->timestamp = $data['timestamp'];
119
        $this->participantId = $data['participantId'];
120
        if (array_key_exists('receivingFrom', $data)) {
121
            $this->receivingFrom = $data['receivingFrom'];
122
        }
123
        $this->audioEnabled = $data['audioEnabled'];
124
        $this->videoEnabled = $data['videoEnabled'];
125
        if (array_key_exists('videoSource', $data)) {
126
            $this->videoSource = $data['videoSource'];
127
            $this->videoFramerate = $data['videoFramerate'];
128
            $this->videoDimensions = $data['videoDimensions'];
129
        }
130
        $this->startTime = $data['startTime'];
131
        $this->duration = $data['duration'];
132
        $this->reason = $data['reason'];
133
        $this->event = $data['event'];
134
    }
135
}