-
Notifications
You must be signed in to change notification settings - Fork 5
/
settings.php
149 lines (128 loc) · 6.83 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* JW Player media plugin settings.
*
* @package media_jwplayer
* @copyright 2017 Ruslan Kabalin, Lancaster University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
require_once(__DIR__ . '/lib.php');
require_once(__DIR__ . '/adminlib.php');
require_once(__DIR__ . '/classes/plugin.php');
$jwplayer = new media_jwplayer_plugin();
// Hosting method.
$hostingmethodchoice = array(
'cloud' => get_string('hostingmethodcloud', 'media_jwplayer'),
'self' => get_string('hostingmethodself', 'media_jwplayer'),
);
$settings->add(new media_jwplayer_hostingmethod_setting('media_jwplayer/hostingmethod',
get_string('hostingmethod', 'media_jwplayer'),
get_string('hostingmethoddesc', 'media_jwplayer', MEDIA_JWPLAYER_CLOUD_VERSION),
'cloud', $hostingmethodchoice));
// License key.
$settings->add(new media_jwplayer_license_setting('media_jwplayer/licensekey',
get_string('licensekey', 'media_jwplayer'),
get_string('licensekeydesc', 'media_jwplayer'),
''));
// Enabled extensions.
$supportedextensions = $jwplayer->list_supported_extensions();
$enabledextensionsmenu = array_combine($supportedextensions, $supportedextensions);
array_splice($supportedextensions, array_search('mpd', $supportedextensions), 1); // disable mpeg-dash as it requires premium licence or higher.
array_splice($supportedextensions, array_search('m3u8', $supportedextensions), 1); // disable HLS by default as it needs a Premium licence
$settings->add(new admin_setting_configmultiselect('media_jwplayer/enabledextensions',
get_string('enabledextensions', 'media_jwplayer'),
get_string('enabledextensionsdesc', 'media_jwplayer'),
$supportedextensions, $enabledextensionsmenu));
// RTMP support.
$settings->add(new admin_setting_configcheckbox('media_jwplayer/supportrtmp',
get_string('supportrtmp', 'media_jwplayer'),
get_string('supportrtmpdesc', 'media_jwplayer'),
0));
// Enabled events to log.
$supportedevents = $jwplayer->list_supported_events();
$supportedeventsmenu = array_combine($supportedevents, $supportedevents);
$settings->add(new admin_setting_configmultiselect('media_jwplayer/enabledevents',
get_string('enabledevents', 'media_jwplayer'),
get_string('enabledeventsdesc', 'media_jwplayer'),
array('play', 'pause', 'complete'), $supportedeventsmenu));
// Appearance related settings.
$settings->add(new admin_setting_heading('appearanceconfig',
get_string('appearanceconfig', 'media_jwplayer'), ''));
// Default Poster Image.
$settings->add(new admin_setting_configstoredfile('media_jwplayer/defaultposter',
get_string('defaultposter', 'media_jwplayer'),
get_string('defaultposterdesc', 'media_jwplayer'),
'defaultposter', 0, array('maxfiles' => 1, 'accepted_types' => array('.jpg', '.png'))));
// Download button.
$settings->add(new admin_setting_configcheckbox('media_jwplayer/downloadbutton',
get_string('downloadbutton', 'media_jwplayer'),
get_string('downloadbuttondesc', 'media_jwplayer'),
0));
// Playback rate controls.
$supportedrates = array('0.25', '0.5', '0.75', '1', '1.25', '1.5', '1.75', '2');
$supportedratesvalues = array_map(function($param) {
return $param . 'x';
}, $supportedrates);
$settings->add(new admin_setting_configmultiselect('media_jwplayer/playbackrates',
get_string('playbackrates', 'media_jwplayer'),
get_string('playbackratesdesc', 'media_jwplayer'),
array('1'), array_combine($supportedrates, $supportedratesvalues)));
// Display Style (Fixed Width or Responsive).
$displaystylechoice = array(
'fixed' => get_string('displayfixed', 'media_jwplayer'),
'responsive' => get_string('displayresponsive', 'media_jwplayer'),
);
$settings->add(new admin_setting_configselect('media_jwplayer/displaystyle',
get_string('displaystyle', 'media_jwplayer'),
get_string('displaystyledesc', 'media_jwplayer'),
'fixed', $displaystylechoice));
// Skins.
$skins = array('beelden', 'bekle', 'five', 'glow', 'roundster', 'six', 'stormtrooper', 'vapor');
$skinoptions = array('' => get_string('standardskin', 'media_jwplayer'));
$skinoptions = array_merge($skinoptions, array_combine($skins, $skins));
$settings->add(new admin_setting_configselect('media_jwplayer/skin',
get_string('useplayerskin', 'media_jwplayer'), '', '', $skinoptions));
// Custom skin.
$settings->add(new admin_setting_configtext('media_jwplayer/customskincss',
get_string('customskincss', 'media_jwplayer'),
get_string('customskincssdesc', 'media_jwplayer'),
''));
// Allow empty title.
$settings->add(new admin_setting_configcheckbox('media_jwplayer/emptytitle',
get_string('emptytitle', 'media_jwplayer'),
get_string('emptytitledesc', 'media_jwplayer'),
0));
// Google Analytics settings.
$settings->add(new admin_setting_heading('googleanalyticsconfig',
get_string('googleanalyticsconfig', 'media_jwplayer'),
get_string('googleanalyticsconfigdesc', 'media_jwplayer')));
$addhtml = new moodle_url('/admin/settings.php', array('section' => 'additionalhtml'));
$settings->add(new admin_setting_configcheckbox('media_jwplayer/googleanalytics',
get_string('googleanalytics', 'media_jwplayer'),
get_string('googleanalyticsdesc', 'media_jwplayer', $addhtml->out()),
0));
$settings->add(new admin_setting_configtext('media_jwplayer/gaidstring',
get_string('gaidstring', 'media_jwplayer'),
get_string('gaidstringdesc', 'media_jwplayer'),
'file'));
$settings->add(new admin_setting_configtext('media_jwplayer/galabel',
get_string('galabel', 'media_jwplayer'),
get_string('galabeldesc', 'media_jwplayer'),
'file'));
}