]> git.mxchange.org Git - friendica-addons.git/blob - webrtc/webrtc.php
8b3a243e32e49174dca797c13d0ca843b31d4df6
[friendica-addons.git] / webrtc / webrtc.php
1 <?php
2 /*
3  * Name: WebRTC Application
4  * Description: add a webrtc instance for video/audio
5  * Version: 1.0
6  * Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan>
7  * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
8  */
9
10 function webrtc_install() {
11         register_hook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
12 }
13
14 function webrtc_uninstall() {
15         unregister_hook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
16
17 }
18
19 function webrtc_app_menu($a,&$b) {
20         $b['app_menu'][] = '<div class="app-title"><a href="webrtc">' . t('WebRTC Videochat') . '</a></div>';
21 }
22
23 function webrtc_plugin_admin (&$a, &$o) {
24         $t = get_markup_template( "admin.tpl", "addon/webrtc/" );
25         $o = replace_macros( $t, array(
26             '$submit' => t('Save Settings'),
27             '$webrtcurl' => array('webrtcurl', t('WebRTC Base URL'), get_config('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')),
28         ));
29 }
30 function webrtc_plugin_admin_post (&$a) {
31         $url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : '');
32             set_config('webrtc', 'webrtcurl', $url);
33             info( t('Settings updated.'). EOL);
34 }
35
36 function webrtc_module() {
37         return;
38 }
39
40 function webrtc_content(&$a) {
41         $o = '';
42
43         /* landingpage to create chatrooms */
44         $webrtcurl = get_config('webrtc','webrtcurl');
45
46         /* embedd the landing page in an iframe */
47         $o .= '<h2>'.t('Video Chat').'</h2>';
48         $o .= '<p>'.t('WebRTC is a video and audio conferencing tool that works with Firefox (version 21 and above) and Chrome/Chromium (version 25 and above). Just create a new chat room and send the link to someone you want to chat with.').'</p>';
49         if ($webrtcurl == '') {
50             $o .= '<p>'.t('Please contact your friendica admin and send a reminder to configure the WebRTC addon.').'</p>';
51         } else {
52             $o .= '<iframe src="'.$webrtcurl.'" width="600px" height="600px"></iframe>';
53         }
54
55
56         return $o;
57 }
58 ?>