};
app.changeVideoMount = function(video, mount) {
- console.log(mount);
+ // This is quite hacky and doesn't feel like the Mithril way to do
+ // things, but we need to explicitly reload the video when the
+ // source URL changes.
video.src = app.mountToStreamUrl(mount);
video.load();
video.play();
];
app.controller = function() {
- var self = this;
-
this.stream = m.prop(app.streams[0]);
this.stats = m.prop(app.nullStats);
-
this.showDesktop = m.prop(false);
- this.updateStats = function() {
- self.stats = app.streamStats(self.stream().speakerMount);
- };
+ // Check stats every 10 seconds.
+ app.scheduleEvery(10000, this.updateStats.bind(this));
+};
- app.scheduleEvery(10000, function() {
- self.updateStats();
- });
+app.controller.prototype.updateStats = function() {
+ this.stats = app.streamStats(this.stream().speakerMount);
};
app.view = function(ctrl) {
var stream = ctrl.stream();
- var showDesktop = ctrl.showDesktop();
var stats = ctrl.stats();
+ var showDesktop = ctrl.showDesktop();
+
+ function renderSpeakerStream() {
+ return m("video.lp-video", {
+ id: "speaker-video",
+ controls: true,
+ autoplay: true
+ }, [
+ m("source", {
+ src: app.mountToStreamUrl(stream.speakerMount)
+ }),
+ m("p",
+ m("em", [
+ "Your browser does not support the HTML5 video tag, ",
+ m("a", { href: "TODO" }, "[ please download ]"),
+ "the video instead"
+ ]))
+ ]);
+ }
function renderDesktopStream() {
return m("video.lp-video", {
renderRoomSelector(),
m("h2", stream.name),
renderStats(),
- m("video.lp-video", {
- id: "speaker-video",
- controls: true,
- autoplay: true
- }, [
- m("source", {
- src: app.mountToStreamUrl(stream.speakerMount)
- }),
- m("p",
- m("em", [
- "Your browser does not support the HTML5 video tag, ",
- m("a", { href: "TODO" }, "[ please download ]"),
- "the video instead"
- ]))
- ]),
+ renderSpeakerStream(),
showDesktop ? renderDesktopStream() : null,
renderToggleDesktopStream(),
m("h2", "IRC"),