PageSourceSearch

https://statics.haiwainet.cn/tpl2020/2020-05-14/videojs/script/videojs/videojs-flash.js

js haiwainet.cn collected 2026-09-24 19:38:22 UTC 40,862 bytes, 1,455 lines download raw bytes

vendor: 9,306 bytes, lines 1-339
1/**
2 * videojs-flash
3 * @version 2.2.1
4 * @copyright 2019 Brightcove, Inc.
5 * @license Apache-2.0
6 */
7(function (global, factory) {
8	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js')) :
9	typeof define === 'function' && define.amd ? define(['video.js'], factory) :
10	(global.videojsFlash = factory(global.videojs));
11}(this, (function (videojs) { 'use strict';
12
13videojs = videojs && videojs.hasOwnProperty('default') ? videojs['default'] : videojs;
14
15var version = "5.4.2";
16
17var version$1 = "2.2.1";
18
19/**
20 * @file flash-rtmp.js
21 * @module flash-rtmp
22 */
23
24/**
25 * Add RTMP properties to the {@link Flash} Tech.
26 *
27 * @param {Flash} Flash
28 *        The flash tech class.
29 *
30 * @mixin FlashRtmpDecorator
31 *
32 * @return {Flash}
33 *         The flash tech with RTMP properties added.
34 */
35function FlashRtmpDecorator(Flash) {
36  Flash.streamingFormats = {
37    'rtmp/mp4': 'MP4',
38    'rtmp/flv': 'FLV'
39  };
40
41  /**
42   * Join connection and stream with an ampersand.
43   *
44   * @param {string} connection
45   *        The connection string.
46   *
47   * @param {string} stream
48   *        The stream string.
49   *
50   * @return {string}
51   *         The connection and stream joined with an `&` character
52   */
53  Flash.streamFromParts = function (connection, stream) {
54    return connection + '&' + stream;
55  };
56
57  /**
58   * The flash parts object that contains connection and stream info.
59   *
60   * @typedef {Object} Flash~PartsObject
61   *
62   * @property {string} connection
63   *           The connection string of a source, defaults to an empty string.
64   *
65   * @property {string} stream
66   *           The stream string of the source, defaults to an empty string.
67   */
68
69  /**
70   * Convert a source url into a stream and connection parts.
71   *
72   * @param {string} src
73   *        the source url
74   *
75   * @return {Flash~PartsObject}
76   *         The parts object that contains a connection and a stream
77   */
78  Flash.streamToParts = function (src) {
79    var parts = {
80      connection: '',
81      stream: ''
82    };
83
84    if (!src) {
85      return parts;
86    }
87
88    // Look for the normal URL separator we expect, '&'.
89    // If found, we split the URL into two pieces around the
90    // first '&'.
91    var connEnd = src.search(/&(?![\w-]+=)/);
92    var streamBegin = void 0;
93
94    if (connEnd !== -1) {
95      streamBegin = connEnd + 1;
96    } else {
97      // If there's not a '&', we use the last '/' as the delimiter.
98      connEnd = streamBegin = src.lastIndexOf('/') + 1;
99      if (connEnd === 0) {
100        // really, there's not a '/'?
101        connEnd = streamBegin = src.length;
102      }
103    }
104
105    parts.connection = src.substring(0, connEnd);
106    parts.stream = src.substring(streamBegin, src.length);
107
108    return parts;
109  };
110
111  /**
112   * Check if the source type is a streaming type.
113   *
114   * @param {string} srcType
115   *        The mime type to check.
116   *
117   * @return {boolean}
118   *          - True if the source type is a streaming type.
119   *          - False if the source type is not a streaming type.
120   */
121  Flash.isStreamingType = function (srcType) {
122    return srcType in Flash.streamingFormats;
123  };
124
125  // RTMP has four variations, any string starting
126  // with one of these protocols should be valid
127
128  /**
129   * Regular expression used to check if the source is an rtmp source.
130   *
131   * @property {RegExp} Flash.RTMP_RE
132   */
133  Flash.RTMP_RE = /^rtmp[set]?:\/\//i;
134
135  /**
136   * Check if the source itself is a streaming type.
137   *
138   * @param {string} src
139   *        The url to the source.
140   *
141   * @return {boolean}
142   *          - True if the source url indicates that the source is streaming.
143   *          - False if the shource url indicates that the source url is not streaming.
144   */
145  Flash.isStreamingSrc = function (src) {
146    return Flash.RTMP_RE.test(src);
147  };
148
149  /**
150   * A source handler for RTMP urls
151   * @type {Object}
152   */
153  Flash.rtmpSourceHandler = {};
154
155  /**
156   * Check if Flash can play the given mime type.
157   *
158   * @param {string} type
159   *        The mime type to check
160   *
161   * @return {string}
162   *         'maybe', or '' (empty string)
163   */
164  Flash.rtmpSourceHandler.canPlayType = function (type) {
165    if (Flash.isStreamingType(type)) {
166      return 'maybe';
167    }
168
169    return '';
170  };
171
172  /**
173   * Check if Flash can handle the source natively
174   *
175   * @param {Object} source
176   *        The source object
177   *
178   * @param {Object} [options]
179   *        The options passed to the tech
180   *
181   * @return {string}
182   *         'maybe', or '' (empty string)
183   */
184  Flash.rtmpSourceHandler.canHandleSource = function (source, options) {
185    var can = Flash.rtmpSourceHandler.canPlayType(source.type);
186
187    if (can) {
188      return can;
189    }
190
191    if (Flash.isStreamingSrc(source.src)) {
192      return 'maybe';
193    }
194
195    return '';
196  };
197
198  /**
199   * Pass the source to the flash object.
200   *
201   * @param {Object} source
202   *        The source object
203   *
204   * @param {Flash} tech
205   *        The instance of the Flash tech
206   *
207   * @param {Object} [options]
208   *        The options to pass to the source
209   */
210  Flash.rtmpSourceHandler.handleSource = function (source, tech, options) {
211    var srcParts = Flash.streamToParts(source.src);
212
213    tech.setRtmpConnection(srcParts.connection);
214    tech.setRtmpStream(srcParts.stream);
215  };
216
217  // Register the native source handler
218  Flash.registerSourceHandler(Flash.rtmpSourceHandler);
219
220  return Flash;
221}
222
223var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
224
225var win;
226
227if (typeof window !== "undefined") {
228    win = window;
229} else if (typeof commonjsGlobal !== "undefined") {
230    win = commonjsGlobal;
231} else if (typeof self !== "undefined"){
232    win = self;
233} else {
234    win = {};
235}
236
237var window_1 = win;
238
239var classCallCheck = function (instance, Constructor) {
240  if (!(instance instanceof Constructor)) {
241    throw new TypeError("Cannot call a class as a function");
242  }
243};
244
245var inherits = function (subClass, superClass) {
246  if (typeof superClass !== "function" && superClass !== null) {
247    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
248  }
249
250  subClass.prototype = Object.create(superClass && superClass.prototype, {
251    constructor: {
252      value: subClass,
253      enumerable: false,
254      writable: true,
255      configurable: true
256    }
257  });
258  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
259};
260
261var possibleConstructorReturn = function (self, call) {
262  if (!self) {
263    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
264  }
265
266  return call && (typeof call === "object" || typeof call === "function") ? call : self;
267};
268
269/**
270 * @file flash.js
271 * VideoJS-SWF - Custom Flash Player with HTML5-ish API
272 * https://github.com/zencoder/video-js-swf
273 * Not using setupTriggers. Using global onEvent func to distribute events
274 */
275
276var Tech = videojs.getComponent('Tech');
277var Dom = videojs.dom;
278var Url = videojs.url;
279var createTimeRange = videojs.createTimeRange;
280var mergeOptions = videojs.mergeOptions;
281
282var navigator = window_1 && window_1.navigator || {};
283
284/**
285 * Flash Media Controller - Wrapper for Flash Media API
286 *
287 * @mixes FlashRtmpDecorator
288 * @mixes Tech~SouceHandlerAdditions
289 * @extends Tech
290 */
291
292var Flash = function (_Tech) {
293  inherits(Flash, _Tech);
294
295  /**
296  * Create an instance of this Tech.
297  *
298  * @param {Object} [options]
299  *        The key/value store of player options.
300  *
301  * @param {Component~ReadyCallback} ready
302  *        Callback function to call when the `Flash` Tech is ready.
303  */
304  function Flash(options, ready) {
305    classCallCheck(this, Flash);
306
307    // Set the source when ready
308    var _this = possibleConstructorReturn(this, _Tech.call(this, options, ready));
309
310    if (options.source) {
311      _this.ready(function () {
312        this.setSource(options.source);
313      }, true);
314    }
315
316    // Having issues with Flash reloading on certain page actions
317    // (hide/resize/fullscreen) in certain browsers
318    // This allows resetting the playhead when we catch the reload
319    if (options.startTime) {
320      _this.ready(function () {
321        this.load();
322        this.play();
323        this.currentTime(options.startTime);
324      }, true);
325    }
326
327    // Add global window functions that the swf expects
328    // A 4.x workflow we weren't able to solve for in 5.0
329    // because of the need to hard code these functions
330    // into the swf for security reasons
331    window_1.videojs = window_1.videojs || {};
332    window_1.videojs.Flash = window_1.videojs.Flash || {};
333    window_1.videojs.Flash.onReady = Flash.onReady;
334    window_1.videojs.Flash.onEvent = Flash.onEvent;
335    window_1.videojs.Flash.onError = Flash.onError;
336
337    _this.on('seeked', function () {
338      this.lastSeekTarget_ = undefined;
339    });
vendor: 7,193 bytes, lines 340-624
340
341    return _this;
342  }
343
344  /**
345   * Create the `Flash` Tech's DOM element.
346   *
347   * @return {Element}
348   *         The element that gets created.
349   */
350
351
352  Flash.prototype.createEl = function createEl() {
353    var options = this.options_;
354
355    // If video.js is hosted locally you should also set the location
356    // for the hosted swf, which should be relative to the page (not video.js)
357    // Otherwise this adds a CDN url.
358    // The CDN also auto-adds a swf URL for that specific version.
359    if (!options.swf) {
360      options.swf = 'https://vjs.zencdn.net/swf/' + version + '/video-js.swf';
361    }
362
363    // Generate ID for swf object
364    var objId = options.techId;
365
366    // Merge default flashvars with ones passed in to init
367    var flashVars = mergeOptions({
368
369      // SWF Callback Functions
370      readyFunction: 'videojs.Flash.onReady',
371      eventProxyFunction: 'videojs.Flash.onEvent',
372      errorEventProxyFunction: 'videojs.Flash.onError',
373
374      // Player Settings
375      autoplay: options.autoplay,
376      preload: options.preload,
377      loop: options.loop,
378      muted: options.muted
379
380    }, options.flashVars);
381
382    // Merge default parames with ones passed in
383    var params = mergeOptions({
384      // Opaque is needed to overlay controls, but can affect playback performance
385      wmode: 'opaque',
386      // Using bgcolor prevents a white flash when the object is loading
387      bgcolor: '#000000'
388    }, options.params);
389
390    // Merge default attributes with ones passed in
391    var attributes = mergeOptions({
392      // Both ID and Name needed or swf to identify itself
393      id: objId,
394      name: objId,
395      'class': 'vjs-tech'
396    }, options.attributes);
397
398    this.el_ = Flash.embed(options.swf, flashVars, params, attributes);
399    this.el_.tech = this;
400
401    return this.el_;
402  };
403
404  /**
405   * Called by {@link Player#play} to play using the `Flash` `Tech`.
406   */
407
408
409  Flash.prototype.play = function play() {
410    if (this.ended()) {
411      this.setCurrentTime(0);
412    }
413    this.el_.vjs_play();
414  };
415
416  /**
417   * Called by {@link Player#pause} to pause using the `Flash` `Tech`.
418   */
419
420
421  Flash.prototype.pause = function pause() {
422    this.el_.vjs_pause();
423  };
424
425  /**
426   * A getter/setter for the `Flash` Tech's source object.
427   * > Note: Please use {@link Flash#setSource}
428   *
429   * @param {Tech~SourceObject} [src]
430   *        The source object you want to set on the `Flash` techs.
431   *
432   * @return {Tech~SourceObject|undefined}
433   *         - The current source object when a source is not passed in.
434   *         - undefined when setting
435   *
436   * @deprecated Since version 5.
437   */
438
439
440  Flash.prototype.src = function src(_src) {
441    if (_src === undefined) {
442      return this.currentSrc();
443    }
444
445    // Setting src through `src` not `setSrc` will be deprecated
446    return this.setSrc(_src);
447  };
448
449  /**
450   * A getter/setter for the `Flash` Tech's source object.
451   *
452   * @param {Tech~SourceObject} [src]
453   *        The source object you want to set on the `Flash` techs.
454   */
455
456
457  Flash.prototype.setSrc = function setSrc(src) {
458    var _this2 = this;
459
460    // Make sure source URL is absolute.
461    src = Url.getAbsoluteURL(src);
462    this.el_.vjs_src(src);
463
464    // Currently the SWF doesn't autoplay if you load a source later.
465    // e.g. Load player w/ no source, wait 2s, set src.
466    if (this.autoplay()) {
467      this.setTimeout(function () {
468        return _this2.play();
469      }, 0);
470    }
471  };
472
473  /**
474   * Indicates whether the media is currently seeking to a new position or not.
475   *
476   * @return {boolean}
477   *         - True if seeking to a new position
478   *         - False otherwise
479   */
480
481
482  Flash.prototype.seeking = function seeking() {
483    return this.lastSeekTarget_ !== undefined;
484  };
485
486  /**
487   * Returns the current time in seconds that the media is at in playback.
488   *
489   * @param {number} time
490   *        Current playtime of the media in seconds.
491   */
492
493
494  Flash.prototype.setCurrentTime = function setCurrentTime(time) {
495    var seekable = this.seekable();
496
497    if (seekable.length) {
498      // clamp to the current seekable range
499      time = time > seekable.start(0) ? time : seekable.start(0);
500      time = time < seekable.end(seekable.length - 1) ? time : seekable.end(seekable.length - 1);
501
502      this.lastSeekTarget_ = time;
503      this.trigger('seeking');
504      this.el_.vjs_setProperty('currentTime', time);
505      _Tech.prototype.setCurrentTime.call(this);
506    }
507  };
508
509  /**
510   * Get the current playback time in seconds
511   *
512   * @return {number}
513   *         The current time of playback in seconds.
514   */
515
516
517  Flash.prototype.currentTime = function currentTime() {
518    // when seeking make the reported time keep up with the requested time
519    // by reading the time we're seeking to
520    if (this.seeking()) {
521      return this.lastSeekTarget_ || 0;
522    }
523    return this.el_.vjs_getProperty('currentTime');
524  };
525
526  /**
527   * Get the current source
528   *
529   * @method currentSrc
530   * @return {Tech~SourceObject}
531   *         The current source
532   */
533
534
535  Flash.prototype.currentSrc = function currentSrc() {
536    if (this.currentSource_) {
537      return this.currentSource_.src;
538    }
539    return this.el_.vjs_getProperty('currentSrc');
540  };
541
542  /**
543   * Get the total duration of the current media.
544   *
545   * @return {number}
546   8          The total duration of the current media.
547   */
548
549
550  Flash.prototype.duration = function duration() {
551    if (this.readyState() === 0) {
552      return NaN;
553    }
554    var duration = this.el_.vjs_getProperty('duration');
555
556    return duration >= 0 ? duration : Infinity;
557  };
558
559  /**
560   * Load media into Tech.
561   */
562
563
564  Flash.prototype.load = function load() {
565    this.el_.vjs_load();
566  };
567
568  /**
569   * Get the poster image that was set on the tech.
570   */
571
572
573  Flash.prototype.poster = function poster() {
574    this.el_.vjs_getProperty('poster');
575  };
576
577  /**
578   * Poster images are not handled by the Flash tech so make this is a no-op.
579   */
580
581
582  Flash.prototype.setPoster = function setPoster() {};
583
584  /**
585   * Determine the time ranges that can be seeked to in the media.
586   *
587   * @return {TimeRange}
588   *         Returns the time ranges that can be seeked to.
589   */
590
591
592  Flash.prototype.seekable = function seekable() {
593    var duration = this.duration();
594
595    if (duration === 0) {
596      return createTimeRange();
597    }
598    return createTimeRange(0, duration);
599  };
600
601  /**
602   * Get and create a `TimeRange` object for buffering.
603   *
604   * @return {TimeRange}
605   *         The time range object that was created.
606   */
607
608
609  Flash.prototype.buffered = function buffered() {
610    var ranges = this.el_.vjs_getProperty('buffered');
611
612    if (ranges.length === 0) {
613      return createTimeRange();
614    }
615    return createTimeRange(ranges[0][0], ranges[0][1]);
616  };
617
618  /**
619   * Get fullscreen support -
620   *
621   * Flash does not allow fullscreen through javascript
622   * so this always returns false.
623   *
624   * @return {boolean}
vendor: 4,139 bytes, lines 625-763
625   *         The Flash tech does not support fullscreen, so it will always return false.
626   */
627
628
629  Flash.prototype.supportsFullScreen = function supportsFullScreen() {
630    // Flash does not allow fullscreen through javascript
631    return false;
632  };
633
634  /**
635   * Flash does not allow fullscreen through javascript
636   * so this always returns false.
637   *
638   * @return {boolean}
639   *         The Flash tech does not support fullscreen, so it will always return false.
640   */
641
642
643  Flash.prototype.enterFullScreen = function enterFullScreen() {
644    return false;
645  };
646
647  /**
648   * Gets available media playback quality metrics as specified by the W3C's Media
649   * Playback Quality API.
650   *
651   * @see [Spec]{@link https://wicg.github.io/media-playback-quality}
652   *
653   * @return {Object}
654   *         An object with supported media playback quality metrics
655   */
656
657
658  Flash.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
659    var videoPlaybackQuality = this.el_.vjs_getProperty('getVideoPlaybackQuality');
660
661    if (window_1.performance && typeof window_1.performance.now === 'function') {
662      videoPlaybackQuality.creationTime = window_1.performance.now();
663    } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === 'number') {
664      videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
665    }
666
667    return videoPlaybackQuality;
668  };
669
670  return Flash;
671}(Tech);
672
673// Create setters and getters for attributes
674
675
676var _readWrite = ['rtmpConnection', 'rtmpStream', 'preload', 'defaultPlaybackRate', 'playbackRate', 'autoplay', 'loop', 'controls', 'volume', 'muted', 'defaultMuted'];
677var _readOnly = ['networkState', 'readyState', 'initialTime', 'startOffsetTime', 'paused', 'ended', 'videoWidth', 'videoHeight'];
678var _api = Flash.prototype;
679
680/**
681 * Create setters for the swf on the element
682 *
683 * @param {string} attr
684 *        The name of the parameter
685 *
686 * @private
687 */
688function _createSetter(attr) {
689  var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
690
691  _api['set' + attrUpper] = function (val) {
692    return this.el_.vjs_setProperty(attr, val);
693  };
694}
695
696/**
697 * Create getters for the swf on the element
698 *
699 * @param {string} attr
700 *        The name of the parameter
701 *
702 * @private
703 */
704function _createGetter(attr) {
705  _api[attr] = function () {
706    return this.el_.vjs_getProperty(attr);
707  };
708}
709
710// Create getter and setters for all read/write attributes
711for (var i = 0; i < _readWrite.length; i++) {
712  _createGetter(_readWrite[i]);
713  _createSetter(_readWrite[i]);
714}
715
716// Create getters for read-only attributes
717for (var _i = 0; _i < _readOnly.length; _i++) {
718  _createGetter(_readOnly[_i]);
719}
720
721/** ------------------------------ Getters ------------------------------ **/
722/**
723 * Get the value of `rtmpConnection` from the swf.
724 *
725 * @method Flash#rtmpConnection
726 * @return {string}
727 *         The current value of `rtmpConnection` on the swf.
728 */
729
730/**
731 * Get the value of `rtmpStream` from the swf.
732 *
733 * @method Flash#rtmpStream
734 * @return {string}
735 *         The current value of `rtmpStream` on the swf.
736 */
737
738/**
739 * Get the value of `preload` from the swf. `preload` indicates
740 * what should download before the media is interacted with. It can have the following
741 * values:
742 * - none: nothing should be downloaded
743 * - metadata: poster and the first few frames of the media may be downloaded to get
744 *   media dimensions and other metadata
745 * - auto: allow the media and metadata for the media to be downloaded before
746 *    interaction
747 *
748 * @method Flash#preload
749 * @return {string}
750 *         The value of `preload` from the swf. Will be 'none', 'metadata',
751 *         or 'auto'.
752 */
753
754/**
755 * Get the value of `defaultPlaybackRate` from the swf.
756 *
757 * @method Flash#defaultPlaybackRate
758 * @return {number}
759 *         The current value of `defaultPlaybackRate` on the swf.
760 */
761
762/**
763 * Get the value of `playbackRate` from the swf. `playbackRate` indicates
764 * the rate at which the media is currently playing back. Examples:
765 *   - if playbackRate is set to 2, media will play twice as fast.
766 *   - if playbackRate is set to 0.5, media will play half as fast.
767 *
768 * @method Flash#playbackRate
769 * @return {number}
770 *         The value of `playbackRate` from the swf. A number indicating
771 *         the current playback speed of the media, where 1 is normal speed.
772 */
773
774/**
775 * Get the value of `autoplay` from the swf. `autoplay` indicates
776 * that the media should start to play as soon as the page is ready.
777 *
778 * @method Flash#autoplay
779 * @return {boolean}
780 *         - The value of `autoplay` from the swf.
781 *         - True indicates that the media ashould start as soon as the page loads.
782 *         - False indicates that the media should not start as soon as the page loads.
783 */
784
785/**
786 * Get the value of `loop` from the swf. `loop` indicates
787 * that the media should return to the start of the media and continue playing once
788 * it reaches the end.
789 *
790 * @method Flash#loop
791 * @return {boolean}
792 *         - The value of `loop` from the swf.
793 *         - True indicates that playback should seek back to start once
794 *           the end of a media is reached.
795 *         - False indicates that playback should not loop back to the start when the
796 *           end of the media is reached.
797 */
798
799/**
800 * Get the value of `mediaGroup` from the swf.
801 *
802 * @method Flash#mediaGroup
803 * @return {string}
804 *         The current value of `mediaGroup` on the swf.
805 */
806
807/**
808 * Get the value of `controller` from the swf.
809 *
810 * @method Flash#controller
811 * @return {string}
812 *         The current value of `controller` on the swf.
813 */
814
815/**
816 * Get the value of `controls` from the swf. `controls` indicates
817 * whether the native flash controls should be shown or hidden.
818 *
819 * @method Flash#controls
820 * @return {boolean}
821 *         - The value of `controls` from the swf.
822 *         - True indicates that native controls should be showing.
823 *         - False indicates that native controls should be hidden.
824 */
825
826/**
827 * Get the value of the `volume` from the swf. `volume` indicates the current
828 * audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and
829 * so on.
830 *
831 * @method Flash#volume
832 * @return {number}
833 *         The volume percent as a decimal. Value will be between 0-1.
834 */
835
836/**
837 * Get the value of the `muted` from the swf. `muted` indicates the current
838 * audio level should be silent.
839 *
840 * @method Flash#muted
841 * @return {boolean}
842 *         - True if the audio should be set to silent
843 *         - False otherwise
844 */
845
846/**
847 * Get the value of `defaultMuted` from the swf. `defaultMuted` indicates
848 * whether the media should start muted or not. Only changes the default state of the
849 * media. `muted` and `defaultMuted` can have different values. `muted` indicates the
850 * current state.
851 *
852 * @method Flash#defaultMuted
853 * @return {boolean}
854 *         - The value of `defaultMuted` from the swf.
855 *         - True indicates that the media should start muted.
856 *         - False indicates that the media should not start muted.
857 */
858
859/**
860 * Get the value of `networkState` from the swf. `networkState` indicates
861 * the current network state. It returns an enumeration from the following list:
862 * - 0: NETWORK_EMPTY
863 * - 1: NEWORK_IDLE
864 * - 2: NETWORK_LOADING
865 * - 3: NETWORK_NO_SOURCE
866 *
867 * @method Flash#networkState
868 * @return {number}
869 *         The value of `networkState` from the swf. This will be a number
870 *         from the list in the description.
871 */
872
873/**
874 * Get the value of `readyState` from the swf. `readyState` indicates
875 * the current state of the media element. It returns an enumeration from the
876 * following list:
877 * - 0: HAVE_NOTHING
878 * - 1: HAVE_METADATA
879 * - 2: HAVE_CURRENT_DATA
880 * - 3: HAVE_FUTURE_DATA
881 * - 4: HAVE_ENOUGH_DATA
882 *
883 * @method Flash#readyState
884 * @return {number}
885 *         The value of `readyState` from the swf. This will be a number
886 *         from the list in the description.
887 */
888
889/**
890 * Get the value of `readyState` from the swf. `readyState` indicates
891 * the current state of the media element. It returns an enumeration from the
892 * following list:
893 * - 0: HAVE_NOTHING
894 * - 1: HAVE_METADATA
895 * - 2: HAVE_CURRENT_DATA
896 * - 3: HAVE_FUTURE_DATA
897 * - 4: HAVE_ENOUGH_DATA
898 *
899 * @method Flash#readyState
900 * @return {number}
901 *         The value of `readyState` from the swf. This will be a number
902 *         from the list in the description.
903 */
904
905/**
906 * Get the value of `initialTime` from the swf.
907 *
908 * @method Flash#initialTime
909 * @return {number}
910 *         The `initialTime` proprety on the swf.
911 */
912
913/**
914 * Get the value of `startOffsetTime` from the swf.
915 *
916 * @method Flash#startOffsetTime
917 * @return {number}
918 *         The `startOffsetTime` proprety on the swf.
919 */
920
921/**
922 * Get the value of `paused` from the swf. `paused` indicates whether the swf
923 * is current paused or not.
924 *
925 * @method Flash#paused
926 * @return {boolean}
927 *         The value of `paused` from the swf.
928 */
929
930/**
931 * Get the value of `ended` from the swf. `ended` indicates whether
932 * the media has reached the end or not.
933 *
934 * @method Flash#ended
935 * @return {boolean}
936 *         - True indicates that the media has ended.
937 *         - False indicates that the media has not ended.
938 *
939 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-ended}
940 */
941
942/**
943 * Get the value of `videoWidth` from the swf. `videoWidth` indicates
944 * the current width of the media in css pixels.
945 *
946 * @method Flash#videoWidth
947 * @return {number}
948 *         The value of `videoWidth` from the swf. This will be a number
949 *         in css pixels.
950 */
951
952/**
953 * Get the value of `videoHeight` from the swf. `videoHeigth` indicates
954 * the current height of the media in css pixels.
955 *
956 * @method Flassh.prototype.videoHeight
957 * @return {number}
958 *         The value of `videoHeight` from the swf. This will be a number
959 *         in css pixels.
960 */
961/** ------------------------------ Setters ------------------------------ **/
962
963/**
964 * Set the value of `rtmpConnection` on the swf.
965 *
966 * @method Flash#setRtmpConnection
967 * @param {string} rtmpConnection
968 *        New value to set the `rtmpConnection` property to.
969 */
970
971/**
972 * Set the value of `rtmpStream` on the swf.
973 *
974 * @method Flash#setRtmpStream
975 * @param {string} rtmpStream
976 *        New value to set the `rtmpStream` property to.
977 */
978
979/**
980 * Set the value of `preload` on the swf. `preload` indicates
981 * what should download before the media is interacted with. It can have the following
982 * values:
983 * - none: nothing should be downloaded
984 * - metadata: poster and the first few frames of the media may be downloaded to get
985 *   media dimensions and other metadata
986 * - auto: allow the media and metadata for the media to be downloaded before
987 *    interaction
988 *
989 * @method Flash#setPreload
990 * @param {string} preload
991 *        The value of `preload` to set on the swf. Should be 'none', 'metadata',
992 *        or 'auto'.
993 */
994
995/**
996 * Set the value of `defaultPlaybackRate` on the swf.
997 *
998 * @method Flash#setDefaultPlaybackRate
999 * @param {number} defaultPlaybackRate
1000 *        New value to set the `defaultPlaybackRate` property to.
1001 */
1002
1003/**
1004 * Set the value of `playbackRate` on the swf. `playbackRate` indicates
1005 * the rate at which the media is currently playing back. Examples:
1006 *   - if playbackRate is set to 2, media will play twice as fast.
1007 *   - if playbackRate is set to 0.5, media will play half as fast.
1008 *
1009 * @method Flash#setPlaybackRate
1010 * @param {number} playbackRate
1011 *        New value of `playbackRate` on the swf. A number indicating
1012 *        the current playback speed of the media, where 1 is normal speed.
1013 */
1014
1015/**
1016 * Set the value of `autoplay` on the swf. `autoplay` indicates
1017 * that the media should start to play as soon as the page is ready.
1018 *
1019 * @method Flash#setAutoplay
1020 * @param {boolean} autoplay
1021 *        - The value of `autoplay` from the swf.
1022 *        - True indicates that the media ashould start as soon as the page loads.
1023 *        - False indicates that the media should not start as soon as the page loads.
1024 */
1025
1026/**
1027 * Set the value of `loop` on the swf. `loop` indicates
1028 * that the media should return to the start of the media and continue playing once
1029 * it reaches the end.
1030 *
1031 * @method Flash#setLoop
1032 * @param {boolean} loop
1033 *        - True indicates that playback should seek back to start once
1034 *          the end of a media is reached.
1035 *        - False indicates that playback should not loop back to the start when the
1036 *          end of the media is reached.
1037 */
1038
1039/**
1040 * Set the value of `mediaGroup` on the swf.
1041 *
1042 * @method Flash#setMediaGroup
1043 * @param {string} mediaGroup
1044 *        New value of `mediaGroup` to set on the swf.
1045 */
1046
1047/**
1048 * Set the value of `controller` on the swf.
1049 *
1050 * @method Flash#setController
1051 * @param {string} controller
1052 *        New value the current value of `controller` on the swf.
1053 */
1054
1055/**
1056 * Get the value of `controls` from the swf. `controls` indicates
1057 * whether the native flash controls should be shown or hidden.
1058 *
1059 * @method Flash#controls
1060 * @return {boolean}
1061 *         - The value of `controls` from the swf.
1062 *         - True indicates that native controls should be showing.
1063 *         - False indicates that native controls should be hidden.
1064 */
1065
1066/**
1067 * Set the value of the `volume` on the swf. `volume` indicates the current
1068 * audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and
1069 * so on.
1070 *
1071 * @method Flash#setVolume
1072 * @param {number} percentAsDecimal
1073 *         The volume percent as a decimal. Value will be between 0-1.
1074 */
1075
1076/**
1077 * Set the value of the `muted` on the swf. `muted` indicates that the current
1078 * audio level should be silent.
1079 *
1080 * @method Flash#setMuted
1081 * @param {boolean} muted
1082 *         - True if the audio should be set to silent
1083 *         - False otherwise
1084 */
1085
1086/**
1087 * Set the value of `defaultMuted` on the swf. `defaultMuted` indicates
1088 * whether the media should start muted or not. Only changes the default state of the
1089 * media. `muted` and `defaultMuted` can have different values. `muted` indicates the
1090 * current state.
1091 *
1092 * @method Flash#setDefaultMuted
1093 * @param {boolean} defaultMuted
1094 *         - True indicates that the media should start muted.
1095 *         - False indicates that the media should not start muted.
1096 */
1097
1098/* Flash Support Testing -------------------------------------------------------- */
1099
1100/**
1101 * Check if the Flash tech is currently supported.
1102 *
1103 * @return {boolean}
1104 *          - True for Chrome and Safari Desktop and Microsoft Edge and if flash tech is supported
1105 *          - False otherwise
1106 */
1107Flash.isSupported = function () {
1108  // for Chrome Desktop and Safari Desktop
1109  if (videojs.browser.IS_CHROME && (!videojs.browser.IS_ANDROID || !videojs.browser.IS_IOS) || videojs.browser.IS_SAFARI && !videojs.browser.IS_IOS || videojs.browser.IS_EDGE) {
1110    return true;
1111  }
1112  // for other browsers
1113  return Flash.version()[0] >= 10;
1114};
1115
1116// Add Source Handler pattern functions to this tech
1117Tech.withSourceHandlers(Flash);
1118
1119/*
1120 * Native source handler for flash,  simply passes the source to the swf element.
1121 *
1122 * @property {Tech~SourceObject} source
1123 *           The source object
1124 *
1125 * @property {Flash} tech
1126 *           The instance of the Flash tech
1127 */
1128Flash.nativeSourceHandler = {};
1129
1130/**
1131 * Check if the Flash can play the given mime type.
1132 *
1133 * @param {string} type
1134 *        The mimetype to check
1135 *
1136 * @return {string}
1137 *         'maybe', or '' (empty string)
1138 */
1139Flash.nativeSourceHandler.canPlayType = function (type) {
1140  if (type in Flash.formats) {
1141    return 'maybe';
1142  }
1143
1144  return '';
1145};
1146
1147/**
1148 * Check if the media element can handle a source natively.
1149 *
1150 * @param {Tech~SourceObject} source
1151 *         The source object
1152 *
1153 * @param {Object} [options]
1154 *         Options to be passed to the tech.
1155 *
1156 * @return {string}
1157 *         'maybe', or '' (empty string).
1158 */
1159Flash.nativeSourceHandler.canHandleSource = function (source, options) {
1160  var type = void 0;
1161
1162  /**
1163   * Guess the mime type of a file if it does not have one
1164   *
1165   * @param {Tech~SourceObject} src
1166   *        The source object to guess the mime type for
1167   *
1168   * @return {string}
1169   *         The mime type that was guessed
1170   */
1171  function guessMimeType(src) {
1172    var ext = Url.getFileExtension(src);
1173
1174    if (ext) {
1175      return 'video/' + ext;
1176    }
1177    return '';
1178  }
1179
1180  if (!source.type) {
1181    type = guessMimeType(source.src);
1182  } else {
1183    // Strip code information from the type because we don't get that specific
1184    type = source.type.replace(/;.*/, '').toLowerCase();
1185  }
1186
1187  return Flash.nativeSourceHandler.canPlayType(type);
1188};
vendor: 4,181 bytes, lines 1189-1348
1189
1190/**
1191 * Pass the source to the swf.
1192 *
1193 * @param {Tech~SourceObject} source
1194 *        The source object
1195 *
1196 * @param {Flash} tech
1197 *        The instance of the Flash tech
1198 *
1199 * @param {Object} [options]
1200 *        The options to pass to the source
1201 */
1202Flash.nativeSourceHandler.handleSource = function (source, tech, options) {
1203  tech.setSrc(source.src);
1204};
1205
1206/**
1207 * noop for native source handler dispose, as cleanup will happen automatically.
1208 */
1209Flash.nativeSourceHandler.dispose = function () {};
1210
1211// Register the native source handler
1212Flash.registerSourceHandler(Flash.nativeSourceHandler);
1213
1214/**
1215 * Flash supported mime types.
1216 *
1217 * @constant {Object}
1218 */
1219Flash.formats = {
1220  'video/flv': 'FLV',
1221  'video/x-flv': 'FLV',
1222  'video/mp4': 'MP4',
1223  'video/m4v': 'MP4'
1224};
1225
1226/**
1227 * Called when the the swf is "ready", and makes sure that the swf is really
1228 * ready using {@link Flash#checkReady}
1229 *
1230 * @param {Object} currSwf
1231 *        The current swf object
1232 */
1233Flash.onReady = function (currSwf) {
1234  var el = Dom.$('#' + currSwf);
1235  var tech = el && el.tech;
1236
1237  // if there is no el then the tech has been disposed
1238  // and the tech element was removed from the player div
1239  if (tech && tech.el()) {
1240    // check that the flash object is really ready
1241    Flash.checkReady(tech);
1242  }
1243};
1244
1245/**
1246 * The SWF isn't always ready when it says it is. Sometimes the API functions still
1247 * need to be added to the object. If it's not ready, we set a timeout to check again
1248 * shortly.
1249 *
1250 * @param {Flash} tech
1251 *        The instance of the flash tech to check.
1252 */
1253Flash.checkReady = function (tech) {
1254  // stop worrying if the tech has been disposed
1255  if (!tech.el()) {
1256    return;
1257  }
1258
1259  // check if API property exists
1260  if (tech.el().vjs_getProperty) {
1261    // tell tech it's ready
1262    tech.triggerReady();
1263  } else {
1264    // wait longer
1265    this.setTimeout(function () {
1266      Flash.checkReady(tech);
1267    }, 50);
1268  }
1269};
1270
1271/**
1272 * Trigger events from the swf on the Flash Tech.
1273 *
1274 * @param {number} swfID
1275 *        The id of the swf that had the event
1276 *
1277 * @param {string} eventName
1278 *        The name of the event to trigger
1279 */
1280Flash.onEvent = function (swfID, eventName) {
1281  var tech = Dom.$('#' + swfID).tech;
1282  var args = Array.prototype.slice.call(arguments, 2);
1283
1284  // dispatch Flash events asynchronously for two reasons:
1285  // - Flash swallows any exceptions generated by javascript it
1286  //   invokes
1287  // - Flash is suspended until the javascript returns which may cause
1288  //   playback performance issues
1289  tech.setTimeout(function () {
1290    tech.trigger(eventName, args);
1291  }, 1);
1292};
1293
1294/**
1295 * Log errors from the swf on the Flash tech.
1296 *
1297 * @param {number} swfID
1298 *        The id of the swf that had an error.
1299 *
1300 * @param {string} err
1301 *        The error to set on the Flash Tech.
1302 *
1303 * @return {MediaError|undefined}
1304 *          - Returns a MediaError when err is 'srcnotfound'
1305 *          - Returns undefined otherwise.
1306 */
1307Flash.onError = function (swfID, err) {
1308  var tech = Dom.$('#' + swfID).tech;
1309
1310  // trigger MEDIA_ERR_SRC_NOT_SUPPORTED
1311  if (err === 'srcnotfound') {
1312    return tech.error(4);
1313  }
1314
1315  // trigger a custom error
1316  if (typeof err === 'string') {
1317    tech.error('FLASH: ' + err);
1318  } else {
1319    err.origin = 'flash';
1320    tech.error(err);
1321  }
1322};
1323
1324/**
1325 * Get the current version of Flash that is in use on the page.
1326 *
1327 * @return {Array}
1328 *          an array of versions that are available.
1329 */
1330Flash.version = function () {
1331  var version$$1 = '0,0,0';
1332
1333  // IE
1334  try {
1335    version$$1 = new window_1.ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
1336
1337    // other browsers
1338  } catch (e) {
1339    try {
1340      if (navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
1341        version$$1 = (navigator.plugins['Shockwave Flash 2.0'] || navigator.plugins['Shockwave Flash']).description.replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
1342      }
1343    } catch (err) {
1344      // satisfy linter
1345    }
1346  }
1347  return version$$1.split(',');
1348};
vendor: 2,911 bytes, lines 1349-1455
1349
1350/**
1351 * Only use for non-iframe embeds.
1352 *
1353 * @param {Object} swf
1354 *        The videojs-swf object.
1355 *
1356 * @param {Object} flashVars
1357 *        Names and values to use as flash option variables.
1358 *
1359 * @param {Object} params
1360 *        Style parameters to set on the object.
1361 *
1362 * @param {Object} attributes
1363 *        Attributes to set on the element.
1364 *
1365 * @return {Element}
1366 *          The embeded Flash DOM element.
1367 */
1368Flash.embed = function (swf, flashVars, params, attributes) {
1369  var code = Flash.getEmbedCode(swf, flashVars, params, attributes);
1370
1371  // Get element by embedding code and retrieving created element
1372  var obj = Dom.createEl('div', { innerHTML: code }).childNodes[0];
1373
1374  return obj;
1375};
1376
1377/**
1378 * Only use for non-iframe embeds.
1379 *
1380 * @param {Object} swf
1381 *        The videojs-swf object.
1382 *
1383 * @param {Object} flashVars
1384 *        Names and values to use as flash option variables.
1385 *
1386 * @param {Object} params
1387 *        Style parameters to set on the object.
1388 *
1389 * @param {Object} attributes
1390 *        Attributes to set on the element.
1391 *
1392 * @return {Element}
1393 *          The embeded Flash DOM element.
1394 */
1395Flash.getEmbedCode = function (swf, flashVars, params, attributes) {
1396  var objTag = '<object type="application/x-shockwave-flash" ';
1397  var flashVarsString = '';
1398  var paramsString = '';
1399  var attrsString = '';
1400
1401  // Convert flash vars to string
1402  if (flashVars) {
1403    Object.getOwnPropertyNames(flashVars).forEach(function (key) {
1404      flashVarsString += key + '=' + flashVars[key] + '&amp;';
1405    });
1406  }
1407
1408  // Add swf, flashVars, and other default params
1409  params = mergeOptions({
1410    movie: swf,
1411    flashvars: flashVarsString,
1412    // Required to talk to swf
1413    allowScriptAccess: 'always',
1414    // All should be default, but having security issues.
1415    allowNetworking: 'all'
1416  }, params);
1417
1418  // Create param tags string
1419  Object.getOwnPropertyNames(params).forEach(function (key) {
1420    paramsString += '<param name="' + key + '" value="' + params[key] + '" />';
1421  });
1422
1423  attributes = mergeOptions({
1424    // Add swf to attributes (need both for IE and Others to work)
1425    data: swf,
1426
1427    // Default to 100% width/height
1428    width: '100%',
1429    height: '100%'
1430
1431  }, attributes);
1432
1433  // Create Attributes string
1434  Object.getOwnPropertyNames(attributes).forEach(function (key) {
1435    attrsString += key + '="' + attributes[key] + '" ';
1436  });
1437
1438  return '' + objTag + attrsString + '>' + paramsString + '</object>';
1439};
1440
1441// Run Flash through the RTMP decorator
1442FlashRtmpDecorator(Flash);
1443
1444if (Tech.getTech('Flash')) {
1445  videojs.log.warn('Not using videojs-flash as it appears to already be registered');
1446  videojs.log.warn('videojs-flash should only be used with video.js@6 and above');
1447} else {
1448  videojs.registerTech('Flash', Flash);
1449}
1450
1451Flash.VERSION = version$1;
1452
1453return Flash;
1454
1455})));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.