1/** 2 * videojs-flvjs 3 * @version 0.2.0 4 * @copyright 2018 mister-ben <[email protected]> 5 * @license Apache-2.0 6 */ 7(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojsFlvjs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 8(function (global){ 9'use strict'; 10 11Object.defineProperty(exports, "__esModule", { 12 value: true 13}); 14 15var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 16 17var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; 18 19var _video = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); 20 21var _video2 = _interopRequireDefault(_video); 22 23function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 24 25function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 26 27function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 28 29function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** 30 * @file plugin.js 31 */ 32 33var Html5 = _video2.default.getTech('Html5'); 34var mergeOptions = _video2.default.mergeOptions || _video2.default.util.mergeOptions; 35var defaults = { 36 mediaDataSource: {},
37 config: {} 38}; 39 40var Flvjs = function (_Html) { 41 _inherits(Flvjs, _Html); 42 43 /** 44 * Create an instance of this Tech. 45 * 46 * @param {Object} [options] 47 * The key/value store of player options. 48 * 49 * @param {Component~ReadyCallback} ready 50 * Callback function to call when the `Flvjs` Tech is ready. 51 */ 52 function Flvjs(options, ready) { 53 _classCallCheck(this, Flvjs); 54 55 options = mergeOptions(defaults, options); 56 return _possibleConstructorReturn(this, (Flvjs.__proto__ || Object.getPrototypeOf(Flvjs)).call(this, options, ready)); 57 } 58 59 /** 60 * A getter/setter for the `Flvjs` Tech's source object. 61 * 62 * @param {Tech~SourceObject} [src] 63 * The source object you want to set on the `Flvjs` techs. 64 * 65 * @return {Tech~SourceObject|undefined} 66 * - The current source object when a source is not passed in. 67 * - undefined when setting 68 */ 69 70 71 _createClass(Flvjs, [{ 72 key: 'setSrc', 73 value: function setSrc(src) { 74 if (this.flvPlayer) { 75 // Is this necessary to change source? 76 this.flvPlayer.detachMediaElement(); 77 this.flvPlayer.destroy(); 78 } 79 80 var mediaDataSource = this.options_.mediaDataSource; 81 var config = this.options_.config; 82 83 mediaDataSource.type = mediaDataSource.type === undefined ? 'flv' : mediaDataSource.type; 84 mediaDataSource.url = src; 85 this.flvPlayer = window.flvjs.createPlayer(mediaDataSource, config); 86 this.flvPlayer.attachMediaElement(this.el_); 87 this.flvPlayer.load(); 88 } 89 90 /** 91 * Dispose of flvjs. 92 */ 93 94 }, { 95 key: 'dispose', 96 value: function dispose() { 97 if (this.flvPlayer) { 98 this.flvPlayer.detachMediaElement(); 99 this.flvPlayer.destroy(); 100 } 101 _get(Flvjs.prototype.__proto__ || Object.getPrototypeOf(Flvjs.prototype), 'dispose', this).call(this); 102 } 103 }]); 104 105 return Flvjs; 106}(Html5); 107 108/** 109 * Check if the Flvjs tech is currently supported. 110 * 111 * @return {boolean} 112 * - True if the Flvjs tech is supported. 113 * - False otherwise. 114 */ 115 116 117Flvjs.isSupported = function () { 118 119 return window.flvjs && window.flvjs.isSupported(); 120}; 121 122/** 123 * Flvjs supported mime types. 124 * 125 * @constant {Object} 126 */ 127Flvjs.formats = { 128 'video/flv': 'FLV', 129 'video/x-flv': 'FLV' 130}; 131 132/** 133 * Check if the tech can support the given type 134 * 135 * @param {string} type 136 * The mimetype to check 137 * @return {string} 'probably', 'maybe', or '' (empty string) 138 */ 139Flvjs.canPlayType = function (type) { 140 if (Flvjs.isSupported() && type in Flvjs.formats) { 141 return 'maybe'; 142 } 143 144 return ''; 145}; 146 147/** 148 * Check if the tech can support the given source 149 * @param {Object} srcObj 150 * The source object 151 * @param {Object} options 152 * The options passed to the tech 153 * @return {string} 'probably', 'maybe', or '' (empty string) 154 */ 155Flvjs.canPlaySource = function (srcObj, options) { 156 return Flvjs.canPlayType(srcObj.type); 157}; 158 159// Include the version number. 160Flvjs.VERSION = '0.2.0'; 161 162_video2.default.registerTech('Flvjs', Flvjs); 163 164exports.default = Flvjs; 165}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 166},{}]},{},[1])(1) 167});
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.