<commit_before>import {Events, Playback, Styler, template} from 'Clappr'

import playbackStyle from './public/style.css'
import playbackHtml from './public/youtube.html'

class YoutubePlayback extends Playback {
  get name() { return 'youtube_playback' }

  get template() { return template(playbackHtml) }

  get attributes() {
    return {
      'data-youtube-playback': '',
      class: 'clappr-youtube-playback',
      id: this.cid
    }
  }

  get ended() { return false }
  get buffering() { return this.player && this.player.getPlayerState() === YT.PlayerState.BUFFERING }
  get isReady() { return this._ready }

  constructor(options) {
    super(options)
    this.options = options
    this.settings = {
      changeCount: 0,
      seekEnabled: true,
      left: ['playpause', 'position', 'duration'],
      default: ['seekbar'],
      right:['fullscreen','volume', 'hd-indicator']
    }
    Clappr.Mediator.on(Clappr.Events.PLAYER_RESIZE, this.updateSize, this)
    this.embedYoutubeApiScript()
  }

  setupYoutubePlayer() {
    if (window.YT && window.YT.Player) {
      this.embedYoutubePlayer()
    } else {
      this.once(Clappr.Events.PLAYBACK_READY, () => this.embedYoutubePlayer())
    }
  }

  embedYoutubeApiScript() {
      let script = document.createElement('script')
      script.setAttribute('type', 'text/javascript')
      script.setAttribute('async', 'async')
      script.setAttribute('src', 'https://www.youtube.com/iframe_api')
      document.body.appendChild(script)
      window.onYouTubeIframeAPIReady = () => this.ready()
  }<commit_msg>plugin: fix exception when setting options<commit_after>import {Events, Playback, Styler, template} from 'Clappr'

import playbackStyle from './public/style.css'
import playbackHtml from './public/youtube.html'

class YoutubePlayback extends Playback {
  get name() { return 'youtube_playback' }

  get template() { return template(playbackHtml) }

  get attributes() {
    return {
      'data-youtube-playback': '',
      class: 'clappr-youtube-playback',
      id: this.cid
    }
  }

  get ended() { return false }
  get buffering() { return this.player && this.player.getPlayerState() === YT.PlayerState.BUFFERING }
  get isReady() { return this._ready }

  constructor(options) {
    super(options)
    this.settings = {
      changeCount: 0,
      seekEnabled: true,
      left: ['playpause', 'position', 'duration'],
      default: ['seekbar'],
      right:['fullscreen','volume', 'hd-indicator']
    }
    Clappr.Mediator.on(Clappr.Events.PLAYER_RESIZE, this.updateSize, this)
    this.embedYoutubeApiScript()
  }

  setupYoutubePlayer() {
    if (window.YT && window.YT.Player) {
      this.embedYoutubePlayer()
    } else {
      this.once(Clappr.Events.PLAYBACK_READY, () => this.embedYoutubePlayer())
    }
  }

  embedYoutubeApiScript() {
      let script = document.createElement('script')
      script.setAttribute('type', 'text/javascript')
      script.setAttribute('async', 'async')
      script.setAttribute('src', 'https://www.youtube.com/iframe_api')
      document.body.appendChild(script)
      window.onYouTubeIframeAPIReady = () => this.ready()
  }
{'fraction_non_alphanumeric': 0.14272091544818818, 'fraction_numerical': 0.0006357279084551812, 'mean_word_length': 3.4701704545454546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6290420', 'n_tokens_mistral': 1000, 'n_tokens_neox': 972, 'n_words': 185}