Skip to content

Instantly share code, notes, and snippets.

@azhurb
Created November 21, 2012 08:54
Show Gist options
  • Select an option

  • Save azhurb/4123883 to your computer and use it in GitHub Desktop.

Select an option

Save azhurb/4123883 to your computer and use it in GitHub Desktop.
Fix time shift bug (issue #1299)
Index: D:/projects/stalker_portal/stalker_portal/c/player.js
===================================================================
--- D:/projects/stalker_portal/stalker_portal/c/player.js (revision 3357)
+++ D:/projects/stalker_portal/stalker_portal/c/player.js (revision 3358)
@@ -1538,7 +1538,10 @@
};
player.prototype.disable_pause = function(){
+ _debug('player.disable_pause');
+ _debug('this.active_time_shift', this.active_time_shift);
+
if (this.active_time_shift){
_debug('new Date() - module.time_shift.cur_media_item.live_date', (new Date().getTime() - module.time_shift.cur_media_item.live_date.getTime())/1000);
@@ -2769,13 +2772,36 @@
if (!reset){
if (this.active_time_shift && module.time_shift){
+
+ _debug('module.time_shift.in_process', module.time_shift.in_process);
+
+ if (module.time_shift.in_process){
+
+ var self = this;
+
+ this.info.hide_timeout = window.setTimeout(function(){
+ self.set_pos_and_play();
+ }, 500);
+
+ _debug('return set_pos_and_play');
+ return;
+ }
+
var new_url = module.time_shift.get_url_by_pos(this.new_pos_time);
_debug('new_url', new_url);
module.time_shift.update_media_item(new_url);
this.play(module.time_shift.cur_media_item);
-
+
+ this.hide_info();
+
+ this.pos_step = 10;
+ this.diff_pos = 0;
+ this.next_step = 0;
+ this.pause.on = false;
+
+ return;
}else if (this.emulate_media_len && module.tv_archive){
/*var new_pos_time = this.new_pos_time + parseInt(this.cur_media_item.position, 10);
@@ -2817,17 +2843,16 @@
}
}catch(e){
_debug(e);
- }finally{
+ }
- this.disable_pause();
- //this.info.dom_obj.hide();
- //this.info.on = false;
- this.hide_info();
-
- this.pos_step = 10;
- this.diff_pos = 0;
- this.next_step = 0;
- }
+ this.disable_pause();
+ //this.info.dom_obj.hide();
+ //this.info.on = false;
+ this.hide_info();
+
+ this.pos_step = 10;
+ this.diff_pos = 0;
+ this.next_step = 0;
};
player.prototype.move_pos = function(dir){
Index: D:/projects/stalker_portal/stalker_portal/c/time_shift.js
===================================================================
--- D:/projects/stalker_portal/stalker_portal/c/time_shift.js (revision 3357)
+++ D:/projects/stalker_portal/stalker_portal/c/time_shift.js (revision 3358)
@@ -11,10 +11,13 @@
module.time_shift = {
cur_media_item : {},
+ in_process : false,
get_link_for_channel : function(){
_debug('time_shift.get_link_for_channel');
+ this.in_process = true;
+
stb.load(
{
"type" : "tv_archive",
@@ -24,6 +27,8 @@
function(result){
_debug('get_link_for_channel result', result);
+ this.in_process = false;
+
this.plt_link = result;
this.cur_media_item.cmd = result;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment