<commit_before>// Copyright 2014 Globo.com Player authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//FIXME review this require approach.
var PlaybackPlugin = require('../../base/playback_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var _ = require("underscore");

var HLSVideoPlaybackPlugin = PlaybackPlugin.extend({
  pluginName: 'hls_playback',
  attributes: {
    'data-hls-playback': ''
  },
  tagName: 'object',
  template: JST.hls_playback,
  initialize: function(options) {
    this.el.src = options.src;
    this.el.id = this.cid;
    this.swfPath = "swf/HLSPlayer.swf"; //FIXME
    this.container.settings = ["play", "stop", "volume", "fullscreen"];

    this.listenTo(this.container, 'container:play', this.play);
    this.listenTo(this.container, 'container:pause', this.pause);
    this.listenTo(this.container, 'container:stop', this.stop);
    this.listenTo(this.container, 'container:seek', this.seek);
    this.listenTo(this.container, 'container:volume', this.volume);
    this.listenTo(this.container, 'container:fullscreen', this.fullscreen);
    this.render();
    this.currentState = "IDLE";
    this.timedCheckState();
    options.autoPlay && this.container.play();
  },
  updateTime: function(interval) {
    return setInterval(function() {
      var time = (100 / (this.el.getDuration() || 1)) * (this.el.getPosition() || 0);
      this.container.timeUpdated(time);
    }.bind(this), interval);
  },
  play: function() {
    if(this.el.getState() === 'IDLE') {
      this.id = this.updateTime(1000);
    }
    if(this.el.getState() === 'PAUSED') {<commit_msg>hls playback plugin: fixes #31<commit_after>// Copyright 2014 Globo.com Player authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//FIXME review this require approach.
var PlaybackPlugin = require('../../base/playback_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var _ = require("underscore");

var HLSVideoPlaybackPlugin = PlaybackPlugin.extend({
  pluginName: 'hls_playback',
  attributes: {
    'data-hls-playback': ''
  },
  tagName: 'object',
  template: JST.hls_playback,
  initialize: function(options) {
    this.el.src = options.src;
    this.el.id = this.cid;
    this.swfPath = "swf/HLSPlayer.swf"; //FIXME
    this.container.settings = ["play", "stop", "volume", "fullscreen"];
    this.autoPlay = options.autoPlay;
    this.listenTo(this.container, 'container:play', this.play);
    this.listenTo(this.container, 'container:pause', this.pause);
    this.listenTo(this.container, 'container:stop', this.stop);
    this.listenTo(this.container, 'container:seek', this.seek);
    this.listenTo(this.container, 'container:volume', this.volume);
    this.listenTo(this.container, 'container:fullscreen', this.fullscreen);
    this.render();
    this.checkIfFlashIsReady();
  },
  bootstrap: function() {
    clearInterval(this.bootstrapId);
    this.currentState = "IDLE";
    this.timedCheckState();
    this.autoPlay && this.container.play();
  },
  checkIfFlashIsReady: function() {
    this.bootstrapId = setInterval(function() {
      if(this.el.getState) {
        this.bootstrap();
      }
    }.bind(this), 50);
  },
  updateTime: function(interval) {
    return setInterval(function() {
      var time = (100 / (this.el.getDuration() || 1)) * (this.el.getPosition() || 0);
      this.container.timeUpdated(time);
    }.bind(this), interval);
  },
  play: function() {
    if(this.el.getState() === 'IDLE') {
      this.id = this.updateTime(1000);
    }
    if(this.el.getState() === 'PAUSED') {
{'fraction_non_alphanumeric': 0.17075119872136388, 'fraction_numerical': 0.007991475759190196, 'mean_word_length': 3.6820448877805485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6181221', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1204, 'n_words': 248}