|
// Get a reference to the SDK, but alias it to a module local variable so that |
|
// there will never be any future global name collisions on the name secondscreenHost |
|
var secondscreenHost = window.secondscreenHost.noConflict(); |
|
|
|
// Disable logging, turn it on for more information on the state of |
|
// the system |
|
secondscreenHost.setLogLevel(secondscreenHost.LogLevels.NONE); |
|
|
|
// Start the second screen service. This starts the process of connecting to |
|
// the Red5Pro Registry service to make an instance of an app disoverable by |
|
// the mobile app |
|
secondscreenHost.start({ |
|
// This is the name that will be displayed in the list on the mobile app |
|
// that users use to choose which host app to connect to |
|
name: "Multi Draw", |
|
|
|
// No more than 10 players can connect. |
|
maxPlayers: 10, |
|
|
|
// This is the legacy Brass Monkey registry. It is now possible |
|
// to self host your own registry server via a Red5Pro subscription |
|
// or to use the hosted Red5Pro service |
|
registryUrl: "ws://162.242.210.105:6262/secondscreen", |
|
//registryUrl: "ws://localhost:6262/secondscreen", |
|
|
|
appId: "secondscreen", |
|
swfobjectUrl: 'scripts/red5pro/swf/swfobject.js', |
|
swfUrl: "scripts/red5pro/swf/secondscreenHost.swf", |
|
|
|
minimumVersion: { |
|
major: 0, |
|
minor: 0 |
|
}, |
|
|
|
// Set the controller mode to use HTML based controls. There are some |
|
// other simple built in controllers. See the Red5Pro Second Screen HTML5 |
|
// documentation for more details |
|
controlMode: secondscreenHost.ControlModes.HTML, |
|
|
|
// Specify the url of our HTML5 based controller. To make sure we don't |
|
// have caching issues with the controller, we add a random parameter to |
|
// prevent caching |
|
controlsUrl: "controller/controller.html?cachebust=" + (new Date().getTime()), |
|
|
|
|
|
error: function(error) { |
|
// The SDK failed to connect to the registry servers. |
|
// TODO: Recommend a recovery strategy for that case. I'm not sure if |
|
// there are automatic retries. Will need to research further |
|
secondscreenHost.log.error('Registry connection error: ' + error); |
|
}, |
|
success: function() { |
|
// The SDK successfully connected to the registry servers |
|
secondscreenHost.log.info('Registry connected.'); |
|
} |
|
}); |