1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the XabbuhPandaBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Xabbuh\PandaBundle\Event; |
13
|
|
|
|
14
|
|
|
use Symfony\Contracts\EventDispatcher\Event; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Event that is triggered repeatedly while an encoding process is running. |
18
|
|
|
* |
19
|
|
|
* @author Christian Flothmann <[email protected]> |
20
|
|
|
* |
21
|
|
|
* @final |
22
|
|
|
*/ |
23
|
|
|
class EncodingProgressEvent extends Event |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* The ENCODING_PROGRESS event occurs repeatedly while an encoding process is running. |
27
|
|
|
* |
28
|
|
|
* The event listener method receives a Xabbuh\PandaBundle\Event\EncodingProgressEvent instance. |
29
|
|
|
*/ |
30
|
|
|
const NAME = 'xabbuh_panda.encoding_progress'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* The id of the encoded video |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $videoId; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The id of the encoding |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
private $encodingId; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The encoding progress |
46
|
|
|
* @var int |
47
|
|
|
*/ |
48
|
|
|
private $progress; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Constructs a new EncodingProgressEvent. |
52
|
|
|
* |
53
|
|
|
* @param string $videoId Video id |
54
|
|
|
* @param string $encodingId Encoding id |
55
|
|
|
* @param int $progress Progress of the encoding |
56
|
|
|
*/ |
57
|
4 |
|
public function __construct($videoId, $encodingId, $progress) |
58
|
|
|
{ |
59
|
4 |
|
$this->videoId = $videoId; |
60
|
4 |
|
$this->encodingId = $encodingId; |
61
|
4 |
|
$this->progress = $progress; |
62
|
4 |
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Returns the video id. |
66
|
|
|
* |
67
|
|
|
* @return string The video id |
68
|
|
|
*/ |
69
|
3 |
|
public function getVideoId() |
70
|
|
|
{ |
71
|
3 |
|
return $this->videoId; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Returns the encoding id. |
76
|
|
|
* |
77
|
|
|
* @return string The encoding id |
78
|
|
|
*/ |
79
|
3 |
|
public function getEncodingId() |
80
|
|
|
{ |
81
|
3 |
|
return $this->encodingId; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Returns the encoding progress. |
86
|
|
|
* |
87
|
|
|
* @return int The progress |
88
|
|
|
*/ |
89
|
3 |
|
public function getProgress() |
90
|
|
|
{ |
91
|
3 |
|
return $this->progress; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|