Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jmrunge/live medias sync #147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions heartbeats.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ heartbeats.prototype.syncMelted = function() {
logger.info("[syncMelted Expected and playing medias are the same");
if (Math.abs(meltedClip.currentFrame - expected.frame) > expected.media.get('fps')) {
logger.info("[syncMelted] I'm over 1 second off")
result = result.then(self.fixMelted.bind(self, expected));
result = result.then(self.fixMelted.bind(self, expected, expected.media.get('live')));
}
}
if (meltedStatus.status !== "playing") {
Expand Down Expand Up @@ -267,10 +267,12 @@ heartbeats.prototype.handleNoMedias = function() {
logger.error("No medias loaded!");
};

heartbeats.prototype.fixMelted = function(expected) {
heartbeats.prototype.fixMelted = function(expected, live) {
var self = this;
logger.warn("Melted is out of sync!");
logger.warn("Melted is out of sync! (Live: %s)", live ? true : false);
self.emit("outOfSync", expected);
if (live)
return;
return self.server.goto(expected.media.get('actual_order'), expected.frame);
};

Expand Down
3 changes: 2 additions & 1 deletion models/Mosto.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Mosto.Media = Backbone.Model.extend({
// end: undefined,
in: undefined,
out: undefined,
blank: false
blank: false,
live: false
},

constructor: function(attributes, options) {
Expand Down