PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / templates / broadcaster-template.php

broadcaster-template.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.8, at templates/broadcaster-template.php

170 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template Name: WPStream OvenLiveKit Broadcaster
4 */
5
6 // Security check
7 if (!defined('ABSPATH')) {
8 exit;
9 }
10
11 // Only allow logged-in users with appropriate permissions
12 if (!is_user_logged_in() || !current_user_can('publish_posts')) {
13 wp_die(__('You do not have sufficient permissions to access this page.', 'wpstream'));
14 }
15
16 // Get channel ID from URL parameter
17 $channel_id = get_query_var('channel_id');
18 if (empty($channel_id)) {
19 wp_die(__('No channel ID specified.', 'wpstream'));
20 }
21
22 // Get stream information from post meta
23 $obs_uri = get_post_meta($channel_id, 'obs_uri', true);
24 $obs_stream = get_post_meta($channel_id, 'obs_stream', true);
25 $whip_url = get_post_meta($channel_id, 'whipUrl', true);
26
27 if (empty($whip_url)) {
28 wp_die(__('WHIP URL not available for this channel.', 'wpstream'));
29 }
30
31 wp_enqueue_style(
32 'wpstream-broadcaster-css',
33 WPSTREAM_PLUGIN_DIR_URL . 'public/css/broadcaster.css',
34 array(),
35 filemtime(WPSTREAM_PLUGIN_PATH . 'public/css/broadcaster.css')
36 );
37
38 wp_enqueue_script(
39 'wpstream-broadcaster-new',
40 WPSTREAM_PLUGIN_DIR_URL . 'public/js/broadcaster.js',
41 array(),
42 filemtime(WPSTREAM_PLUGIN_PATH . 'public/js/broadcaster.js'),
43 true
44 );
45
46 wp_localize_script(
47 'wpstream-broadcaster-new',
48 'wpstream_broadcaster_vars',
49 array(
50 'ajax_url' => admin_url('admin-ajax.php'),
51 'nonce' => wp_create_nonce('wpstream_broadcaster_nonce'),
52 'plugin_url' => plugin_dir_url(__FILE__),
53 'obs_uri' => $obs_uri,
54 'obs_stream' => $obs_stream,
55 'channel_id' => $channel_id,
56 'is_channel_live' => get_post_meta($channel_id, 'status', true),
57 'whip_url' => get_post_meta($channel_id, 'whipUrl', true),
58 'no_video_audio_access' => esc_html__('We couldn’t access your camera or microphone. Please allow permissions and reload the page.', 'wpstream'),
59 'no_audio_access' => esc_html__('We couldn’t access your microphone. Please allow permissions and reload the page.', 'wpstream'),
60 'no_video_access' => esc_html__('We couldn’t access your camera. Please allow permissions and reload the page.', 'wpstream'),
61 'channel_off' => esc_html__('Invalid event. Your live event may have expired or its credentials are incorrect.', 'wpstream'),
62 'not_enough_traffic' => sprintf(
63 esc_html__('Not enough streaming traffic to broadcast. Please %supgrade your subscription%s for extra resources.', 'wpstream'),
64 '<a href="https://wpstream.net/pricing/" target="_blank">',
65 '</a>'
66 ),
67 )
68 );
69
70 ?>
71 <!DOCTYPE html>
72 <html <?php language_attributes(); ?>>
73 <head>
74 <meta charset="<?php bloginfo('charset'); ?>">
75 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
76 <title><?php esc_html_e('WpStream Broadcaster', 'wpstream'); ?></title>
77
78 <?php wp_head(); ?>
79
80 <!-- Load required libraries in correct order -->
81 <script src="https://cdn.jsdelivr.net/npm/underscore@1.12.0/underscore-min.js"></script>
82 <script src="https://cdn.jsdelivr.net/npm/ovenlivekit@latest/dist/OvenLiveKit.min.js"></script>
83 </head>
84 <body class="wpstream-broadcaster-page">
85 <header class="broadcaster-header">
86 <div class="header-container">
87 <div class="header-logo">
88 <a href="<?php echo esc_url(home_url('/')); ?>">
89 <img src="<?php echo esc_url(WPSTREAM_PLUGIN_DIR_URL . 'img/wpstream-logo.svg'); ?>" alt="WpStream Logo">
90 </a>
91 </div>
92 <nav class="header-nav">
93 <span class="nav-item">Browser Broadcaster</span>
94 </nav>
95 </div>
96 </header>
97
98 <div id="messageContainer"></div>
99
100 <div class="broadcaster-container">
101 <div class="wrapper">
102 <div class="video-container">
103 <div id="videoLiveIndicator" class="video-live-indicator">
104 <span id="videoLiveIndicatorLive" class="badge badge-pill badge-danger" style="display:none;"><?php esc_html_e('LIVE', 'wpstream'); ?></span>
105 <span id="videoLiveIndicatorError" class="badge badge-pill badge-warning" style="display:none;"><?php esc_html_e('Connecting...', 'wpstream'); ?></span>
106 </div>
107 <video id="localVideo" autoplay muted playsinline></video>
108 </div>
109
110 <div class="settings-panel" id="settingsPanel">
111 <div>
112 <div class="controls-container">
113 <button id="startBroadcast" class="button start-broadcast" disabled><?php esc_html_e('Start Broadcast', 'wpstream'); ?></button>
114 <button id="stopBroadcast" class="button stop-broadcast hidden"><?php esc_html_e('Stop Broadcast', 'wpstream'); ?></button>
115 </div>
116 <div class="status-container">
117 <div>
118 <span class="status-indicator" id="statusIndicator"></span>
119 <span id="statusText"><?php esc_html_e('Not connected', 'wpstream'); ?></span>
120 </div>
121 </div>
122 </div>
123
124 <div class="settings-row media-row">
125 <div class="settings-group">
126 <label for="videoDevice"><?php esc_html_e('Video Source', 'wpstream'); ?></label>
127 <div class="controls-group">
128 <select id="videoDevice">
129 <option selected></option>
130 </select>
131 <button id="videoToggle" class="control-button">
132 <img alt="" class="noll" id="video-off" src="<?php echo esc_url(WPSTREAM_PLUGIN_DIR_URL . 'img/videocam-32px.svg'); ?>">
133 <img alt="" class="noll" id="video-on" src="<?php echo esc_url(WPSTREAM_PLUGIN_DIR_URL . 'img/videocam-off-32px.svg'); ?>" style="display:none;">
134 </button>
135 </div>
136 </div>
137
138 <div class="settings-group">
139 <label for="audioDevice"><?php esc_html_e('Audio Source', 'wpstream'); ?></label>
140 <div class="controls-group">
141 <select id="audioDevice">
142 <option selected></option>
143 </select>
144 <button id="audioToggle" class="control-button">
145 <img alt="" class="noll" id="audio-off" src="<?php echo esc_url( WPSTREAM_PLUGIN_DIR_URL . 'img/mic-32px.svg' ); ?>">
146 <img alt="" class="noll" id="audio-on" src="<?php echo esc_url( WPSTREAM_PLUGIN_DIR_URL . 'img/mic-off-32px.svg' ); ?>" style="display:none;">
147 </button>
148 </div>
149 </div>
150 </div>
151
152 <div class="settings-row">
153 <div class="settings-group">
154 <label for="videoQuality"><?php esc_html_e('Video Resolution', 'wpstream'); ?></label>
155 <select id="videoQuality">
156 <option selected value="default">Default</option>
157 <option value="fhd"><?php esc_html_e('1920x1080', 'wpstream'); ?></option>
158 <option value="hd"><?php esc_html_e('1280x720', 'wpstream'); ?></option>
159 <option value="square"><?php esc_html_e('800x600', 'wpstream'); ?></option>
160 <option value="vga"><?php esc_html_e('640x480', 'wpstream'); ?></option>
161 </select>
162 </div>
163 </div>
164 </div>
165 </div>
166 </div>
167
168 <?php wp_footer(); ?>
169 </body>
170 </html>