Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
video.php
1
<?php
2
3
namespace
Bitrix\Main\UI\Viewer\Renderer
;
4
5
use
Bitrix\Main\Loader
;
6
use
Bitrix\Main\Web\Uri
;
7
8
class
Video
extends
Renderer
9
{
10
const
WIDTH
= 700;
11
const
HEIGHT
= 700;
12
13
const
JS_TYPE_VIDEO
=
'video'
;
14
15
public
function
getWidth
()
16
{
17
return
$this->
getOption
(
'width'
, self::WIDTH);
18
}
19
20
public
function
getHeight
()
21
{
22
return
$this->
getOption
(
'height'
, self::HEIGHT);
23
}
24
25
public
static
function
getJsType
()
26
{
27
return
self::JS_TYPE_VIDEO
;
28
}
29
30
public
static
function
getAllowedContentTypes
()
31
{
32
return
[
33
'video/mp4'
,
34
'video/x-flv'
,
35
'video/webm'
,
36
'video/ogg'
,
37
'video/quicktime'
,
38
];
39
}
40
41
public
function
render
()
42
{
43
Loader::includeModule
(
'fileman'
);
44
45
return \CJSCore::getHTML([
'player'
]);
46
}
47
48
public
function
getData
()
49
{
50
$data = [
51
'width'
=> $this->
getWidth
(),
52
'height'
=> $this->
getHeight
(),
53
'contentType'
=> $this->
getOption
(
'contentType'
),
54
'src'
=>
$this->sourceUri
,
55
];
56
57
$sources = [
58
[
59
'src'
=>
$this->sourceUri
,
60
'type'
=> $this->
getOption
(
'contentType'
),
61
]
62
];
63
$sources = $this->modifySourcesByDirtyHacks($sources);
64
65
$altSrc = $this->
getOption
(
'alt.sourceUri'
);
66
if
($altSrc)
67
{
68
array_unshift($sources, [
69
'src'
=> $altSrc,
70
'type'
=> $this->
getOption
(
'alt.contentType'
),
71
]);
72
}
73
$data[
'sources'
] = $sources;
74
75
return
$data;
76
}
77
78
protected
function
modifySourcesByDirtyHacks(array $sources)
79
{
80
$updatedSources = $sources;
81
foreach
($sources as $source)
82
{
83
if
($source[
'type'
] ===
'video/quicktime'
)
84
{
85
//some browser can work with quicktime :)
87
$src = clone $source[
'src'
];
88
$src->addParams([
'fakeUnique'
=>
'qt'
,]);
89
90
$updatedSources[] = [
91
'src'
=> $src,
92
'type'
=>
'video/mp4'
,
93
];
94
}
95
}
96
97
return
$updatedSources;
98
}
99
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Definition
loader.php:69
Bitrix\Main\UI\Viewer\Renderer\Renderer
Definition
renderer.php:9
Bitrix\Main\UI\Viewer\Renderer\Renderer\$sourceUri
$sourceUri
Definition
renderer.php:14
Bitrix\Main\UI\Viewer\Renderer\Renderer\getOption
getOption($name, $defaultValue=null)
Definition
renderer.php:25
Bitrix\Main\UI\Viewer\Renderer\Video
Definition
video.php:9
Bitrix\Main\UI\Viewer\Renderer\Video\HEIGHT
const HEIGHT
Definition
video.php:11
Bitrix\Main\UI\Viewer\Renderer\Video\JS_TYPE_VIDEO
const JS_TYPE_VIDEO
Definition
video.php:13
Bitrix\Main\UI\Viewer\Renderer\Video\getAllowedContentTypes
static getAllowedContentTypes()
Definition
video.php:30
Bitrix\Main\UI\Viewer\Renderer\Video\getData
getData()
Definition
video.php:48
Bitrix\Main\UI\Viewer\Renderer\Video\WIDTH
const WIDTH
Definition
video.php:10
Bitrix\Main\UI\Viewer\Renderer\Video\getJsType
static getJsType()
Definition
video.php:25
Bitrix\Main\UI\Viewer\Renderer\Video\getHeight
getHeight()
Definition
video.php:20
Bitrix\Main\UI\Viewer\Renderer\Video\getWidth
getWidth()
Definition
video.php:15
Bitrix\Main\UI\Viewer\Renderer\Video\render
render()
Definition
video.php:41
Bitrix\Main\Web\Uri
Definition
uri.php:17
Bitrix\Main\UI\Viewer\Renderer
Definition
audio.php:3
modules
main
lib
ui
viewer
renderer
video.php
Создано системой
1.10.0