I have a <video>
element that keeps pausing (no network issue, no buffering issue … video file plays fine when I automatically play the video again after it’s been paused) and I’ve been trying to find the cause of it and thought it might be time to ask for help. I’ve been trying to backtrace it but the only way I’ve come up with to do that it is in a template event handler like so:
Template.video.events({
'pause video'(event, tmpl) {
console.error('Video paused!');
console.trace(event);
// Wait for 2s and then try playing again
Meteor.setTimeout(function () {
tmpl.find('video').play();
}, 2000);
}
});
All that gives me is the source of the template event handler in Blaze and not the source of the function or code that’s pausing the video.
I made sure that it wasn’t a reactivity issue (that the <video>
element wasn’t being changed by meteor reactivity) by logging all template renders with this:
logRenders = function logRenders (filter) {
for (name in Object(Template)){
if (filter && !Array.isArray(filter)) filter = [filter];
var template = Template[name];
if (!template) continue;
if (filter && filter.indexOf(name) == -1){
// Clear previous logRenders
if ('oldRender' in template) template.rendered = template.oldRender;
delete template.oldRender;
continue;
}
var t = function(name, template){
if (!('oldRender' in template)) template.oldRender = template.rendered;
var counter = 0;
template.rendered = function () {
console.log(name, ++counter, this);
this.oldRender && this.oldRender.apply(this, arguments);
};
}(name, template);
};
};
The app is running within Cordova and I’m using Safari to debug. I’m completely out of ideas and thought I’d turn to the community for help. If anyone has an idea of how best to debug this or a better way of back tracing, all help / input would be greatly appreciated.