Passed
Push — master ( 7abbc2...44d0ac )
by Jacobo
04:02
created

WebRTCConnectionDestroyed::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

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