Reputation:
If a user is watching a video, or streaming audio on a page in my Meteor app, is there something I can use to prevent that particular player element from refreshing/stopping/closing during a Hot Code Reload when new code is pushed?
Currently, if I make a change to the code base and a user is watching/listening to something, they will be interrupted and the player will stop.
Upvotes: 0
Views: 303
Reputation: 75945
You could use the onMigrate api (undocumented) to disable a hot code push if someone is watching a video:
function onMigrate (retry) {
//Return [true, data] to allow it to hot code reload, data being anything you want to be available when the page reloads
return false;
}
Meteor._reload.onMigrate("someName", onMigrate);
// or Meteor._reload.onMigrate(onMigrate);
There's also a videocast covering this on eventedmind and a bit of a comment about it on github: https://github.com/meteor/meteor/blob/devel/packages/reload/reload.js#L81-L94
Upvotes: 0