web/activities/video/static-src/js/show/video-play.js

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

import swfobject from 'es-swfobject';
import EsMessenger from 'app/common/messenger';
import { getSupportedPlayer } from 'common/video-player-judge';
import ActivityEmitter from 'app/js/activity/activity-emitter';

export default class VideoPlay {
  constructor(recorder) {
    this.player = {};
    this.intervalId = null;
    this.recorder = recorder;
    this.emitter = new ActivityEmitter();
  }

  play() {
    if ($('#swf-player').length) {
      this.flashTip();
      this._playerSwf();
    } else {
      if (getSupportedPlayer() === 'flash') {
        this.flashTip(true);
      } else {
        this._playVideo();
      }
    }
    this.record();
  }


  flashTip(flag) {
    if (!swfobject.hasFlashPlayerVersion('11')) {
      const html = `
      <div class="alert alert-warning alert-dismissible fade in" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
        <span aria-hidden="true">×</span>
        </button>
        ${Translator.trans('site.flash_not_install_hint')}
      </div>`;
      $('#video-content').html(html).show();
    } else {
      if (flag) {
        this._playVideo();
      }
    }
  }

  record() {
    this.intervalId = setInterval(() => {
      this.recorder.addVideoPlayerCounter(this.emitter, this.player);
    }, 1000);
  }

  getPlay() {
    return this.player;
  }

  _playerSwf() {
    const swf_dom = 'swf-player';
    swfobject.embedSWF($('#' + swf_dom).data('url'),
      swf_dom, '100%', '100%', '9.0.0', null, null, {
        wmode: 'opaque',

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。