SpreedMe returns a blank/white screen when trying to access the app

Hey guys, Im trying to install the Spreed Me app on my Nextcloud server. So far I think i’ve set everything up properly following instructions from GitHub and Nextcloud. However when trying to access the app after it is enabled, it does not open to anything. Just a blank screen inside nextcloud.

I am able to view the Spread Me app when I visit https://cloud.mydomain.com/webrtc. However, I get a warning to view the app inside of Nexcloud. It restricts access and redirects back to https://cloud.mydomain.com (which is fine, I want to access via Nextcloud)

Here is the environment at which everything is setup:
VPS Server, Linux Centos 6.8 with cpanel/whm running Apache 4

Error from index.php/spreedme/admin/debug

Spreed.ME Version 0.3.5

Ran test #1 (testOwncloudPhpConfigFile):
Passed without an error

Ran test #2 (testOwncloudJavascriptConfigFile):
Passed without an error

Ran test #3 (testSpreedWebRTCAPI):
Error: Unable to connect to WebRTC at ‘’NAN. Did you set a correct SPREED_WEBRTC_ORIGIN and SPREED_WEBRTC_BASEPATH in config/config.php?

Some tests failed. :frowning:

Error from Console on Chrome.

The value for Content Security Policy directive ‘frame-src’ contains an invalid character: ‘‘’ mailto:’. Non-whitespace characters outside ASCII 0x21-0x7E must be percent-encoded, as described in RFC 3986, section 2.1: tools.ietf.org/html/rfc3986#section-2.1.
(index):323 Refused to frame ‘https://cloud.mydomain.com/index.php/apps/spreedme/‘’NAN?load_config_js=1’ because it violates the following Content Security Policy directive: “default-src ‘none’”. Note that ‘frame-src’ was not explicitly set, so ‘default-src’ is used as a fallback.

Nextcloud log

Error PHP Division by zero at /home/crown90/cloud/apps/spreedme/helper/helper.php#68 ago
Error PHP Use of undefined constant ’ - assumed ‘’’ at /home/crown90/cloud/apps/spreedme/helper/helper.php#68 a few seconds ago
Error PHP Division by zero at /home/crown90/cloud/apps/spreedme/helper/helper.php#68
Error PHP Use of undefined constant webrtc - assumed ‘webrtc’ at /home/crown90/cloud/apps/spreedme/helper/helper.php#68
Error PHP Use of undefined constant ‘ - assumed ‘‘’ at /home/crown90/cloud/apps/spreedme/helper/helper.php#68
Error PHP Use of undefined constant ‘’ - assumed ‘‘’’ at /home/crown90/cloud/apps/spreedme/helper/helper.php#68

WebRTC Server Config.

[details=Summary]; Minimal Spreed WebRTC configuration for Nextcloud

[http]
listen = 127.0.0.1:8080
basePath = /webrtc/

[app]
sessionSecret = 4ced289eb9ca9e78f9ecdaaffb15456ec706c3cf48c974a21dfb8bc6367cf57c
encryptionSecret = c88f345d3e3f3c183c17674fd6bbcc8155413b524d03749bd875160c230cf5b3
authorizeRoomJoin = true
serverToken = fbdd4dd5b4780a5c77ee378d608d286d3e7cdc657b60bf574f1be08f03bda62f
serverRealm = local
extra = /home/crown90/cloud/apps/spreedme/extra
plugin = extra/static/owncloud.js

[users]
enabled = true
mode = sharedsecret
sharedsecret_secret = 7a13441c0023244b2a1f2142f62a9631********************************[/details]

Spreed.ME Config.php

[details=Summary]<?php
/**

  • Nextcloud - spreedme
  • This file is licensed under the Affero General Public License version 3 or
  • later. See the COPYING file.
  • @author Leon leon@strukturde
  • @copyright struktur AG 2016
    */

namespace OCA\SpreedME\Config;

class Config {

// Domain of your Spreed WebRTC server (including protocol and optional port number), examples:
//const SPREED_WEBRTC_ORIGIN = 'https://mynextcloudserver.com';
//const SPREED_WEBRTC_ORIGIN = 'https://webrtc.mynextcloudserver.com:8080';
// If this is empty or only includes a port (e.g. :8080), host will automatically be determined (current host)
const SPREED_WEBRTC_ORIGIN = ‘’;

// This has to be the same `basePath`
// you already set in the [http] section of the `server.conf` file from Spreed WebRTC server
const SPREED_WEBRTC_BASEPATH = ‘/webrtc/’;

// This has to be the same `sharedsecret_secret` (64-character HEX string)
// you already set in the [users] section of the `server.conf` file from Spreed WebRTC server
const SPREED_WEBRTC_SHAREDSECRET = '7a13441c0023244b2a1f2142f62a9631********************************';

// Set to true if at least one another Nextcloud instance uses the same Spreed WebRTC server
const SPREED_WEBRTC_IS_SHARED_INSTANCE = false;

// Set to true if you want to allow access to this app + spreed-webrtc for non-registered users who received a temporary password by an Nextcloud admin.
// You can generate such a temporary password at: /index.php/apps/spreedme/admin/tp (Nextcloud admin user account required)
const OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED = false;

// If 'OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED' is set to true, you also have to provide a signing key here (64-character HEX string)
// Generate it using `xxd -ps -l 32 -c 32 /dev/random` (better) or `openssl rand -hex 32`
const OWNCLOUD_TEMPORARY_PASSWORD_SIGNING_KEY = '';

private function __construct() {

}

}[/details]

Apache Configuration

//Spreed WebRTC config (must be in same vhost)

<Location /webrtc> 
ProxyPass http://127.0.0.1:8080/webrtc 
ProxyPassReverse /webrtc 
</Location> 
<Location /webrtc/ws> 
ProxyPass ws://127.0.0.1:8080/webrtc/ws 
</Location> 
ProxyVia On 
ProxyPreserveHost On 
RequestHeader set X-Forwarded-Proto 'https' env=HTTPS

WebRTC via Terminal:

root@vps20670 [/home/crown90/spreed-webrtc-master]# ./spreed-webrtc-server
server 2017/01/03 21:40:45 Using ‘/webrtc/’ base base path.
server 2017/01/03 21:40:45.891297 Enabled modules: [screensharing youtube presentation contacts]
server 2017/01/03 21:40:45.892261 Loaded extra templates from: /home/crown90/cloud/apps/spreedme/extra
server 2017/01/03 21:40:45.892272 Max open files are 4096
server 2017/01/03 21:40:45.892797 Enabled users handler 'sharedsecret’
server 2017/01/03 21:40:45.892907 Added URL handler /extra/static/… for static files in /home/crown90/cloud/apps/spreedme/extra/static/…
server 2017/01/03 21:40:45 Starting HTTP server on 127.0.0.1:8080

Added this file too incase its needed ( I dont think so )

[details=Helper.php]<?php
/**

  • Nextcloud - spreedme
  • This file is licensed under the Affero General Public License version 3 or
  • later. See the COPYING file.
  • @author Leon leon@struktur.de
  • @copyright struktur AG 2016
    */

namespace OCA\SpreedME\Helper;

use OCA\SpreedME\Errors\ErrorCodes;
use OCA\SpreedME\Settings\Settings;

class Helper {

private static $defaultConfig = array(
	'SPREED_WEBRTC_ORIGIN' => '',
	'SPREED_WEBRTC_BASEPATH' => '/webrtc/',
	'SPREED_WEBRTC_IS_SHARED_INSTANCE' => false,
	'OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED' => false,
);

private function __construct() {

}

public static function getOwnHost($port = null) {
	$request = \OC::$server->getRequest();

	$protocol = $request->getServerProtocol();
	$hostname = $request->getInsecureServerHost();
	// The host has already been checked against the trusted_domains in
	// lib/base.php (function init).

	if (!empty($port)) {
		// Strip existing port (if any) from hostname.
		$pos = strrpos($hostname, ':');
		if ($pos !== false) {
			$hostport = substr($hostname, $pos + 1);
			if (is_numeric($hostport)) {
				$hostname = substr($hostname, 0, $pos);
			}
		}

		// Append new port (but only if it isn't the default port for the current protocol).
		$is_http = ($protocol === 'http');
		$is_https = ($protocol === 'https');
		if (($is_http && $port !== '80') || ($is_https && $port !== '443')) {
			$hostname = $hostname . ':' . $port;
		}
	}

	return $protocol . '://' . $hostname;
}

private static function getDefaultValue($key) {
	if (isset(self::$defaultConfig[$key])) {
		return self::$defaultConfig[$key];
	}
	return null;
}

private static function getFileConfigValue($key) {
	$constantName = '\OCA\SpreedME\Config\Config::' . $key;
	if (defined($constantName)) {
		return constant($constantName);
	}
	return null;
}

public static function getDatabaseConfigValue($key) {
	$value = \OC::$server->getConfig()->getAppValue(Settings::APP_ID, $key);
	if ($value === 'true' || $value === 'false') {
		// TODO(leon): How can we improve this?
		$value = ($value === 'true');
	}
	return $value;
}

public static function getDatabaseConfigValueOrDefault($key) {
	if (self::getDatabaseConfigValue('is_set_up') === true) {
		return self::getDatabaseConfigValue($key);
	}
	$default = self::getDefaultValue($key);
	if ($default !== null) {
		return $default;
	}
	return '';
}

public static function getConfigValue($key) {
	if (self::doesPhpConfigExist()) {
		return self::getFileConfigValue($key);
	}
	return self::getDatabaseConfigValue($key);
}

private static function setDatabaseConfigValue($key, $value) {
	\OC::$server->getConfig()->setAppValue(Settings::APP_ID, $key, $value);
}

public static function setDatabaseConfigValueIfEnabled($key, $value) {
	if (self::doesPhpConfigExist()) {
		throw new \Exception('config/config.php exists. Can\'t modify DB config values', ErrorCodes::DB_CONFIG_ERROR_CONFIG_PHP_EXISTS);
	}
	self::setDatabaseConfigValue($key, $value);
}

public static function getOwnAppVersion() {
	return \OCP\App::getAppVersion(Settings::APP_ID);
}

public static function getOwnAppPath() {
	return realpath(__DIR__ . '/..') . '/';
}

public static function getAppPath($app) {
	return sprintf('%s/../%s/', realpath(__DIR__ . '/..'), $app);
}

public static function notifyIfAppNotSetUp() {
	if (!self::doesPhpConfigExist() && self::getDatabaseConfigValue('is_set_up') !== true) {
		die('You didn\'t set up this Nextcloud app. Please open the Nextcloud admin settings page and configure this app.');
	}
}

public static function doesPhpConfigExist() {
	return class_exists('\OCA\SpreedME\Config\Config', true);
}

public static function doesJsConfigExist() {
	return is_file(self::getOwnAppPath() . 'extra/static/config/OwnCloudConfig.js');
}

public static function getSpreedWebRtcOrigin() {
	$origin = self::getConfigValue('SPREED_WEBRTC_ORIGIN');
	$is_port = !empty($origin) && $origin[0] === ':';
	$port = null;
	if ($is_port) {
		$port = str_replace(':', '', $origin);
	}
	if (empty($origin) || $is_port) {
		$origin = self::getOwnHost($port);
	}
	return $origin;
}

public static function getSpreedWebRtcUrl($debug = null, $includeQueryParams = true) {
	$origin = self::getSpreedWebRtcOrigin();
	$basepath = self::getConfigValue('SPREED_WEBRTC_BASEPATH');
	$url = $origin . $basepath;
	$params = array();

	if ($debug !== false) {
		if ($debug === true || isset($_GET['debug'])) {
			$params['debug'] = true;
		}
	}
	if ($includeQueryParams) {
		if (self::doesJsConfigExist()) {
			$params['load_config_js'] = true;
		}
		$query = http_build_query($params);
		if (!empty($query)) {
			$url .= '?' . $query;
		}
	}

	return $url;
}

}[/details]

Any help would be greatly appreciated. I am no expert by any means but somewhat familiar with my server. Getting this up an running has been my number 1 challenge! Thanks in advance and happy new year!

Hey guys, just wanted to update you all. I finally got it up and running. What I did was delete both the owncloudconfig.js file and the config.php file on the spread.me app under nextcloud. Under admin in Nextcloud the Spread.Me App will configure its own .js file and .php file. Make sure the SPREED_WEBRTC_BASEPATH is set correctly and you should be good to go! Just need to do a little more configuring now to get connections to users outside my network. Hope this helps anyone in need.

  • Cheers

Hi @DavidMichael,

just for the records:
It looks like you’ve used the invalid single-quotes instead of ' in config.php.
Replacing all with ' should resolve the issue.