[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/ -> media-audiovideo.js (source)

   1  /******/ (() => { // webpackBootstrap
   2  /******/     var __webpack_modules__ = ({
   3  
   4  /***/ 1206:
   5  /***/ ((module) => {
   6  
   7  var State = wp.media.controller.State,
   8      l10n = wp.media.view.l10n,
   9      AudioDetails;
  10  
  11  /**
  12   * wp.media.controller.AudioDetails
  13   *
  14   * The controller for the Audio Details state
  15   *
  16   * @memberOf wp.media.controller
  17   *
  18   * @class
  19   * @augments wp.media.controller.State
  20   * @augments Backbone.Model
  21   */
  22  AudioDetails = State.extend(/** @lends wp.media.controller.AudioDetails.prototype */{
  23      defaults: {
  24          id: 'audio-details',
  25          toolbar: 'audio-details',
  26          title: l10n.audioDetailsTitle,
  27          content: 'audio-details',
  28          menu: 'audio-details',
  29          router: false,
  30          priority: 60
  31      },
  32  
  33      initialize: function( options ) {
  34          this.media = options.media;
  35          State.prototype.initialize.apply( this, arguments );
  36      }
  37  });
  38  
  39  module.exports = AudioDetails;
  40  
  41  
  42  /***/ }),
  43  
  44  /***/ 5039:
  45  /***/ ((module) => {
  46  
  47  /**
  48   * wp.media.controller.VideoDetails
  49   *
  50   * The controller for the Video Details state
  51   *
  52   * @memberOf wp.media.controller
  53   *
  54   * @class
  55   * @augments wp.media.controller.State
  56   * @augments Backbone.Model
  57   */
  58  var State = wp.media.controller.State,
  59      l10n = wp.media.view.l10n,
  60      VideoDetails;
  61  
  62  VideoDetails = State.extend(/** @lends wp.media.controller.VideoDetails.prototype */{
  63      defaults: {
  64          id: 'video-details',
  65          toolbar: 'video-details',
  66          title: l10n.videoDetailsTitle,
  67          content: 'video-details',
  68          menu: 'video-details',
  69          router: false,
  70          priority: 60
  71      },
  72  
  73      initialize: function( options ) {
  74          this.media = options.media;
  75          State.prototype.initialize.apply( this, arguments );
  76      }
  77  });
  78  
  79  module.exports = VideoDetails;
  80  
  81  
  82  /***/ }),
  83  
  84  /***/ 241:
  85  /***/ ((module) => {
  86  
  87  /**
  88   * wp.media.model.PostMedia
  89   *
  90   * Shared model class for audio and video. Updates the model after
  91   *   "Add Audio|Video Source" and "Replace Audio|Video" states return
  92   *
  93   * @memberOf wp.media.model
  94   *
  95   * @class
  96   * @augments Backbone.Model
  97   */
  98  var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{
  99      initialize: function() {
 100          this.attachment = false;
 101      },
 102  
 103      setSource: function( attachment ) {
 104          this.attachment = attachment;
 105          this.extension = attachment.get( 'filename' ).split('.').pop();
 106  
 107          if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) {
 108              this.unset( 'src' );
 109          }
 110  
 111          if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
 112              this.set( this.extension, this.attachment.get( 'url' ) );
 113          } else {
 114              this.unset( this.extension );
 115          }
 116      },
 117  
 118      changeAttachment: function( attachment ) {
 119          this.setSource( attachment );
 120  
 121          this.unset( 'src' );
 122          _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) {
 123              this.unset( ext );
 124          }, this );
 125      }
 126  });
 127  
 128  module.exports = PostMedia;
 129  
 130  
 131  /***/ }),
 132  
 133  /***/ 3713:
 134  /***/ ((module) => {
 135  
 136  var MediaDetails = wp.media.view.MediaDetails,
 137      AudioDetails;
 138  
 139  /**
 140   * wp.media.view.AudioDetails
 141   *
 142   * @memberOf wp.media.view
 143   *
 144   * @class
 145   * @augments wp.media.view.MediaDetails
 146   * @augments wp.media.view.Settings.AttachmentDisplay
 147   * @augments wp.media.view.Settings
 148   * @augments wp.media.View
 149   * @augments wp.Backbone.View
 150   * @augments Backbone.View
 151   */
 152  AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{
 153      className: 'audio-details',
 154      template:  wp.template('audio-details'),
 155  
 156      setMedia: function() {
 157          var audio = this.$('.wp-audio-shortcode');
 158  
 159          if ( audio.find( 'source' ).length ) {
 160              if ( audio.is(':hidden') ) {
 161                  audio.show();
 162              }
 163              this.media = MediaDetails.prepareSrc( audio.get(0) );
 164          } else {
 165              audio.hide();
 166              this.media = false;
 167          }
 168  
 169          return this;
 170      }
 171  });
 172  
 173  module.exports = AudioDetails;
 174  
 175  
 176  /***/ }),
 177  
 178  /***/ 175:
 179  /***/ ((module) => {
 180  
 181  var MediaDetails = wp.media.view.MediaFrame.MediaDetails,
 182      MediaLibrary = wp.media.controller.MediaLibrary,
 183  
 184      l10n = wp.media.view.l10n,
 185      AudioDetails;
 186  
 187  /**
 188   * wp.media.view.MediaFrame.AudioDetails
 189   *
 190   * @memberOf wp.media.view.MediaFrame
 191   *
 192   * @class
 193   * @augments wp.media.view.MediaFrame.MediaDetails
 194   * @augments wp.media.view.MediaFrame.Select
 195   * @augments wp.media.view.MediaFrame
 196   * @augments wp.media.view.Frame
 197   * @augments wp.media.View
 198   * @augments wp.Backbone.View
 199   * @augments Backbone.View
 200   * @mixes wp.media.controller.StateMachine
 201   */
 202  AudioDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.AudioDetails.prototype */{
 203      defaults: {
 204          id:      'audio',
 205          url:     '',
 206          menu:    'audio-details',
 207          content: 'audio-details',
 208          toolbar: 'audio-details',
 209          type:    'link',
 210          title:    l10n.audioDetailsTitle,
 211          priority: 120
 212      },
 213  
 214      initialize: function( options ) {
 215          options.DetailsView = wp.media.view.AudioDetails;
 216          options.cancelText = l10n.audioDetailsCancel;
 217          options.addText = l10n.audioAddSourceTitle;
 218  
 219          MediaDetails.prototype.initialize.call( this, options );
 220      },
 221  
 222      bindHandlers: function() {
 223          MediaDetails.prototype.bindHandlers.apply( this, arguments );
 224  
 225          this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this );
 226          this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this );
 227      },
 228  
 229      createStates: function() {
 230          this.states.add([
 231              new wp.media.controller.AudioDetails( {
 232                  media: this.media
 233              } ),
 234  
 235              new MediaLibrary( {
 236                  type: 'audio',
 237                  id: 'replace-audio',
 238                  title: l10n.audioReplaceTitle,
 239                  toolbar: 'replace-audio',
 240                  media: this.media,
 241                  menu: 'audio-details'
 242              } ),
 243  
 244              new MediaLibrary( {
 245                  type: 'audio',
 246                  id: 'add-audio-source',
 247                  title: l10n.audioAddSourceTitle,
 248                  toolbar: 'add-audio-source',
 249                  media: this.media,
 250                  menu: false
 251              } )
 252          ]);
 253      }
 254  });
 255  
 256  module.exports = AudioDetails;
 257  
 258  
 259  /***/ }),
 260  
 261  /***/ 741:
 262  /***/ ((module) => {
 263  
 264  var Select = wp.media.view.MediaFrame.Select,
 265      l10n = wp.media.view.l10n,
 266      MediaDetails;
 267  
 268  /**
 269   * wp.media.view.MediaFrame.MediaDetails
 270   *
 271   * @memberOf wp.media.view.MediaFrame
 272   *
 273   * @class
 274   * @augments wp.media.view.MediaFrame.Select
 275   * @augments wp.media.view.MediaFrame
 276   * @augments wp.media.view.Frame
 277   * @augments wp.media.View
 278   * @augments wp.Backbone.View
 279   * @augments Backbone.View
 280   * @mixes wp.media.controller.StateMachine
 281   */
 282  MediaDetails = Select.extend(/** @lends wp.media.view.MediaFrame.MediaDetails.prototype */{
 283      defaults: {
 284          id:      'media',
 285          url:     '',
 286          menu:    'media-details',
 287          content: 'media-details',
 288          toolbar: 'media-details',
 289          type:    'link',
 290          priority: 120
 291      },
 292  
 293      initialize: function( options ) {
 294          this.DetailsView = options.DetailsView;
 295          this.cancelText = options.cancelText;
 296          this.addText = options.addText;
 297  
 298          this.media = new wp.media.model.PostMedia( options.metadata );
 299          this.options.selection = new wp.media.model.Selection( this.media.attachment, { multiple: false } );
 300          Select.prototype.initialize.apply( this, arguments );
 301      },
 302  
 303      bindHandlers: function() {
 304          var menu = this.defaults.menu;
 305  
 306          Select.prototype.bindHandlers.apply( this, arguments );
 307  
 308          this.on( 'menu:create:' + menu, this.createMenu, this );
 309          this.on( 'content:render:' + menu, this.renderDetailsContent, this );
 310          this.on( 'menu:render:' + menu, this.renderMenu, this );
 311          this.on( 'toolbar:render:' + menu, this.renderDetailsToolbar, this );
 312      },
 313  
 314      renderDetailsContent: function() {
 315          var view = new this.DetailsView({
 316              controller: this,
 317              model: this.state().media,
 318              attachment: this.state().media.attachment
 319          }).render();
 320  
 321          this.content.set( view );
 322      },
 323  
 324      renderMenu: function( view ) {
 325          var lastState = this.lastState(),
 326              previous = lastState && lastState.id,
 327              frame = this;
 328  
 329          view.set({
 330              cancel: {
 331                  text:     this.cancelText,
 332                  priority: 20,
 333                  click:    function() {
 334                      if ( previous ) {
 335                          frame.setState( previous );
 336                      } else {
 337                          frame.close();
 338                      }
 339                  }
 340              },
 341              separateCancel: new wp.media.View({
 342                  className: 'separator',
 343                  priority: 40
 344              })
 345          });
 346  
 347      },
 348  
 349      setPrimaryButton: function(text, handler) {
 350          this.toolbar.set( new wp.media.view.Toolbar({
 351              controller: this,
 352              items: {
 353                  button: {
 354                      style:    'primary',
 355                      text:     text,
 356                      priority: 80,
 357                      click:    function() {
 358                          var controller = this.controller;
 359                          handler.call( this, controller, controller.state() );
 360                          // Restore and reset the default state.
 361                          controller.setState( controller.options.state );
 362                          controller.reset();
 363                      }
 364                  }
 365              }
 366          }) );
 367      },
 368  
 369      renderDetailsToolbar: function() {
 370          this.setPrimaryButton( l10n.update, function( controller, state ) {
 371              controller.close();
 372              state.trigger( 'update', controller.media.toJSON() );
 373          } );
 374      },
 375  
 376      renderReplaceToolbar: function() {
 377          this.setPrimaryButton( l10n.replace, function( controller, state ) {
 378              var attachment = state.get( 'selection' ).single();
 379              controller.media.changeAttachment( attachment );
 380              state.trigger( 'replace', controller.media.toJSON() );
 381          } );
 382      },
 383  
 384      renderAddSourceToolbar: function() {
 385          this.setPrimaryButton( this.addText, function( controller, state ) {
 386              var attachment = state.get( 'selection' ).single();
 387              controller.media.setSource( attachment );
 388              state.trigger( 'add-source', controller.media.toJSON() );
 389          } );
 390      }
 391  });
 392  
 393  module.exports = MediaDetails;
 394  
 395  
 396  /***/ }),
 397  
 398  /***/ 8646:
 399  /***/ ((module) => {
 400  
 401  var MediaDetails = wp.media.view.MediaFrame.MediaDetails,
 402      MediaLibrary = wp.media.controller.MediaLibrary,
 403      l10n = wp.media.view.l10n,
 404      VideoDetails;
 405  
 406  /**
 407   * wp.media.view.MediaFrame.VideoDetails
 408   *
 409   * @memberOf wp.media.view.MediaFrame
 410   *
 411   * @class
 412   * @augments wp.media.view.MediaFrame.MediaDetails
 413   * @augments wp.media.view.MediaFrame.Select
 414   * @augments wp.media.view.MediaFrame
 415   * @augments wp.media.view.Frame
 416   * @augments wp.media.View
 417   * @augments wp.Backbone.View
 418   * @augments Backbone.View
 419   * @mixes wp.media.controller.StateMachine
 420   */
 421  VideoDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.VideoDetails.prototype */{
 422      defaults: {
 423          id:      'video',
 424          url:     '',
 425          menu:    'video-details',
 426          content: 'video-details',
 427          toolbar: 'video-details',
 428          type:    'link',
 429          title:    l10n.videoDetailsTitle,
 430          priority: 120
 431      },
 432  
 433      initialize: function( options ) {
 434          options.DetailsView = wp.media.view.VideoDetails;
 435          options.cancelText = l10n.videoDetailsCancel;
 436          options.addText = l10n.videoAddSourceTitle;
 437  
 438          MediaDetails.prototype.initialize.call( this, options );
 439      },
 440  
 441      bindHandlers: function() {
 442          MediaDetails.prototype.bindHandlers.apply( this, arguments );
 443  
 444          this.on( 'toolbar:render:replace-video', this.renderReplaceToolbar, this );
 445          this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this );
 446          this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this );
 447          this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this );
 448      },
 449  
 450      createStates: function() {
 451          this.states.add([
 452              new wp.media.controller.VideoDetails({
 453                  media: this.media
 454              }),
 455  
 456              new MediaLibrary( {
 457                  type: 'video',
 458                  id: 'replace-video',
 459                  title: l10n.videoReplaceTitle,
 460                  toolbar: 'replace-video',
 461                  media: this.media,
 462                  menu: 'video-details'
 463              } ),
 464  
 465              new MediaLibrary( {
 466                  type: 'video',
 467                  id: 'add-video-source',
 468                  title: l10n.videoAddSourceTitle,
 469                  toolbar: 'add-video-source',
 470                  media: this.media,
 471                  menu: false
 472              } ),
 473  
 474              new MediaLibrary( {
 475                  type: 'image',
 476                  id: 'select-poster-image',
 477                  title: l10n.videoSelectPosterImageTitle,
 478                  toolbar: 'select-poster-image',
 479                  media: this.media,
 480                  menu: 'video-details'
 481              } ),
 482  
 483              new MediaLibrary( {
 484                  type: 'text',
 485                  id: 'add-track',
 486                  title: l10n.videoAddTrackTitle,
 487                  toolbar: 'add-track',
 488                  media: this.media,
 489                  menu: 'video-details'
 490              } )
 491          ]);
 492      },
 493  
 494      renderSelectPosterImageToolbar: function() {
 495          this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) {
 496              var urls = [], attachment = state.get( 'selection' ).single();
 497  
 498              controller.media.set( 'poster', attachment.get( 'url' ) );
 499              state.trigger( 'set-poster-image', controller.media.toJSON() );
 500  
 501              _.each( wp.media.view.settings.embedExts, function (ext) {
 502                  if ( controller.media.get( ext ) ) {
 503                      urls.push( controller.media.get( ext ) );
 504                  }
 505              } );
 506  
 507              wp.ajax.send( 'set-attachment-thumbnail', {
 508                  data : {
 509                      _ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail,
 510                      urls: urls,
 511                      thumbnail_id: attachment.get( 'id' )
 512                  }
 513              } );
 514          } );
 515      },
 516  
 517      renderAddTrackToolbar: function() {
 518          this.setPrimaryButton( l10n.videoAddTrackTitle, function( controller, state ) {
 519              var attachment = state.get( 'selection' ).single(),
 520                  content = controller.media.get( 'content' );
 521  
 522              if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) {
 523                  content += [
 524                      '<track srclang="en" label="English" kind="subtitles" src="',
 525                      attachment.get( 'url' ),
 526                      '" />'
 527                  ].join('');
 528  
 529                  controller.media.set( 'content', content );
 530              }
 531              state.trigger( 'add-track', controller.media.toJSON() );
 532          } );
 533      }
 534  });
 535  
 536  module.exports = VideoDetails;
 537  
 538  
 539  /***/ }),
 540  
 541  /***/ 9467:
 542  /***/ ((module) => {
 543  
 544  /* global MediaElementPlayer */
 545  var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay,
 546      $ = jQuery,
 547      MediaDetails;
 548  
 549  /**
 550   * wp.media.view.MediaDetails
 551   *
 552   * @memberOf wp.media.view
 553   *
 554   * @class
 555   * @augments wp.media.view.Settings.AttachmentDisplay
 556   * @augments wp.media.view.Settings
 557   * @augments wp.media.View
 558   * @augments wp.Backbone.View
 559   * @augments Backbone.View
 560   */
 561  MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{
 562      initialize: function() {
 563          _.bindAll(this, 'success');
 564          this.players = [];
 565          this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers );
 566          this.on( 'ready', this.setPlayer );
 567          this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
 568          this.on( 'media:setting:remove', this.render );
 569          this.on( 'media:setting:remove', this.setPlayer );
 570  
 571          AttachmentDisplay.prototype.initialize.apply( this, arguments );
 572      },
 573  
 574      events: function(){
 575          return _.extend( {
 576              'click .remove-setting' : 'removeSetting',
 577              'change .content-track' : 'setTracks',
 578              'click .remove-track' : 'setTracks',
 579              'click .add-media-source' : 'addSource'
 580          }, AttachmentDisplay.prototype.events );
 581      },
 582  
 583      prepare: function() {
 584          return _.defaults({
 585              model: this.model.toJSON()
 586          }, this.options );
 587      },
 588  
 589      /**
 590       * Remove a setting's UI when the model unsets it
 591       *
 592       * @fires wp.media.view.MediaDetails#media:setting:remove
 593       *
 594       * @param {Event} e
 595       */
 596      removeSetting : function(e) {
 597          var wrap = $( e.currentTarget ).parent(), setting;
 598          setting = wrap.find( 'input' ).data( 'setting' );
 599  
 600          if ( setting ) {
 601              this.model.unset( setting );
 602              this.trigger( 'media:setting:remove', this );
 603          }
 604  
 605          wrap.remove();
 606      },
 607  
 608      /**
 609       *
 610       * @fires wp.media.view.MediaDetails#media:setting:remove
 611       */
 612      setTracks : function() {
 613          var tracks = '';
 614  
 615          _.each( this.$('.content-track'), function(track) {
 616              tracks += $( track ).val();
 617          } );
 618  
 619          this.model.set( 'content', tracks );
 620          this.trigger( 'media:setting:remove', this );
 621      },
 622  
 623      addSource : function( e ) {
 624          this.controller.lastMime = $( e.currentTarget ).data( 'mime' );
 625          this.controller.setState( 'add-' + this.controller.defaults.id + '-source' );
 626      },
 627  
 628      loadPlayer: function () {
 629          this.players.push( new MediaElementPlayer( this.media, this.settings ) );
 630          this.scriptXhr = false;
 631      },
 632  
 633      setPlayer : function() {
 634          var src;
 635  
 636          if ( this.players.length || ! this.media || this.scriptXhr ) {
 637              return;
 638          }
 639  
 640          src = this.model.get( 'src' );
 641  
 642          if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) {
 643              this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) );
 644          } else {
 645              this.loadPlayer();
 646          }
 647      },
 648  
 649      /**
 650       * @abstract
 651       */
 652      setMedia : function() {
 653          return this;
 654      },
 655  
 656      success : function(mejs) {
 657          var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
 658  
 659          if ( 'flash' === mejs.pluginType && autoplay ) {
 660              mejs.addEventListener( 'canplay', function() {
 661                  mejs.play();
 662              }, false );
 663          }
 664  
 665          this.mejs = mejs;
 666      },
 667  
 668      /**
 669       * @return {media.view.MediaDetails} Returns itself to allow chaining.
 670       */
 671      render: function() {
 672          AttachmentDisplay.prototype.render.apply( this, arguments );
 673  
 674          setTimeout( _.bind( function() {
 675              this.scrollToTop();
 676          }, this ), 10 );
 677  
 678          this.settings = _.defaults( {
 679              success : this.success
 680          }, wp.media.mixin.mejsSettings );
 681  
 682          return this.setMedia();
 683      },
 684  
 685      scrollToTop: function() {
 686          this.$( '.embed-media-settings' ).scrollTop( 0 );
 687      }
 688  },/** @lends wp.media.view.MediaDetails */{
 689      instances : 0,
 690      /**
 691       * When multiple players in the DOM contain the same src, things get weird.
 692       *
 693       * @param {HTMLElement} elem
 694       * @return {HTMLElement}
 695       */
 696      prepareSrc : function( elem ) {
 697          var i = MediaDetails.instances++;
 698          _.each( $( elem ).find( 'source' ), function( source ) {
 699              source.src = [
 700                  source.src,
 701                  source.src.indexOf('?') > -1 ? '&' : '?',
 702                  '_=',
 703                  i
 704              ].join('');
 705          } );
 706  
 707          return elem;
 708      }
 709  });
 710  
 711  module.exports = MediaDetails;
 712  
 713  
 714  /***/ }),
 715  
 716  /***/ 5836:
 717  /***/ ((module) => {
 718  
 719  var MediaDetails = wp.media.view.MediaDetails,
 720      VideoDetails;
 721  
 722  /**
 723   * wp.media.view.VideoDetails
 724   *
 725   * @memberOf wp.media.view
 726   *
 727   * @class
 728   * @augments wp.media.view.MediaDetails
 729   * @augments wp.media.view.Settings.AttachmentDisplay
 730   * @augments wp.media.view.Settings
 731   * @augments wp.media.View
 732   * @augments wp.Backbone.View
 733   * @augments Backbone.View
 734   */
 735  VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{
 736      className: 'video-details',
 737      template:  wp.template('video-details'),
 738  
 739      setMedia: function() {
 740          var video = this.$('.wp-video-shortcode');
 741  
 742          if ( video.find( 'source' ).length ) {
 743              if ( video.is(':hidden') ) {
 744                  video.show();
 745              }
 746  
 747              if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) {
 748                  this.media = MediaDetails.prepareSrc( video.get(0) );
 749              } else {
 750                  this.media = video.get(0);
 751              }
 752          } else {
 753              video.hide();
 754              this.media = false;
 755          }
 756  
 757          return this;
 758      }
 759  });
 760  
 761  module.exports = VideoDetails;
 762  
 763  
 764  /***/ })
 765  
 766  /******/     });
 767  /************************************************************************/
 768  /******/     // The module cache
 769  /******/     var __webpack_module_cache__ = {};
 770  /******/     
 771  /******/     // The require function
 772  /******/ 	function __webpack_require__(moduleId) {
 773  /******/         // Check if module is in cache
 774  /******/         var cachedModule = __webpack_module_cache__[moduleId];
 775  /******/         if (cachedModule !== undefined) {
 776  /******/             return cachedModule.exports;
 777  /******/         }
 778  /******/         // Create a new module (and put it into the cache)
 779  /******/         var module = __webpack_module_cache__[moduleId] = {
 780  /******/             // no module.id needed
 781  /******/             // no module.loaded needed
 782  /******/             exports: {}
 783  /******/         };
 784  /******/     
 785  /******/         // Execute the module function
 786  /******/         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 787  /******/     
 788  /******/         // Return the exports of the module
 789  /******/         return module.exports;
 790  /******/     }
 791  /******/     
 792  /************************************************************************/
 793  var __webpack_exports__ = {};
 794  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
 795  (() => {
 796  /**
 797   * @output wp-includes/js/media-audiovideo.js
 798   */
 799  
 800  var media = wp.media,
 801      baseSettings = window._wpmejsSettings || {},
 802      l10n = window._wpMediaViewsL10n || {};
 803  
 804  /**
 805   *
 806   * Defines the wp.media.mixin object.
 807   *
 808   * @mixin
 809   *
 810   * @since 4.2.0
 811   */
 812  wp.media.mixin = {
 813      mejsSettings: baseSettings,
 814  
 815      /**
 816       * Pauses and removes all players.
 817       *
 818       * @since 4.2.0
 819       *
 820       * @return {void}
 821       */
 822      removeAllPlayers: function() {
 823          var p;
 824  
 825          if ( window.mejs && window.mejs.players ) {
 826              for ( p in window.mejs.players ) {
 827                  window.mejs.players[p].pause();
 828                  this.removePlayer( window.mejs.players[p] );
 829              }
 830          }
 831      },
 832  
 833      /**
 834       * Removes the player.
 835       *
 836       * Override the MediaElement method for removing a player.
 837       * MediaElement tries to pull the audio/video tag out of
 838       * its container and re-add it to the DOM.
 839       *
 840       * @since 4.2.0
 841       *
 842       * @return {void}
 843       */
 844      removePlayer: function(t) {
 845          var featureIndex, feature;
 846  
 847          if ( ! t.options ) {
 848              return;
 849          }
 850  
 851          // Invoke features cleanup.
 852          for ( featureIndex in t.options.features ) {
 853              feature = t.options.features[featureIndex];
 854              if ( t['clean' + feature] ) {
 855                  try {
 856                      t['clean' + feature](t);
 857                  } catch (e) {}
 858              }
 859          }
 860  
 861          if ( ! t.isDynamic ) {
 862              t.node.remove();
 863          }
 864  
 865          if ( 'html5' !== t.media.rendererName ) {
 866              t.media.remove();
 867          }
 868  
 869          delete window.mejs.players[t.id];
 870  
 871          t.container.remove();
 872          t.globalUnbind('resize', t.globalResizeCallback);
 873          t.globalUnbind('keydown', t.globalKeydownCallback);
 874          t.globalUnbind('click', t.globalClickCallback);
 875          delete t.media.player;
 876      },
 877  
 878      /**
 879       *
 880       * Removes and resets all players.
 881       *
 882       * Allows any class that has set 'player' to a MediaElementPlayer
 883       * instance to remove the player when listening to events.
 884       *
 885       * Examples: modal closes, shortcode properties are removed, etc.
 886       *
 887       * @since 4.2.0
 888       */
 889      unsetPlayers : function() {
 890          if ( this.players && this.players.length ) {
 891              _.each( this.players, function (player) {
 892                  player.pause();
 893                  wp.media.mixin.removePlayer( player );
 894              } );
 895              this.players = [];
 896          }
 897      }
 898  };
 899  
 900  /**
 901   * Shortcode modeling for playlists.
 902   *
 903   * @since 4.2.0
 904   */
 905  wp.media.playlist = new wp.media.collection({
 906      tag: 'playlist',
 907      editTitle : l10n.editPlaylistTitle,
 908      defaults : {
 909          id: wp.media.view.settings.post.id,
 910          style: 'light',
 911          tracklist: true,
 912          tracknumbers: true,
 913          images: true,
 914          artists: true,
 915          type: 'audio'
 916      }
 917  });
 918  
 919  /**
 920   * Shortcode modeling for audio.
 921   *
 922   * `edit()` prepares the shortcode for the media modal.
 923   * `shortcode()` builds the new shortcode after an update.
 924   *
 925   * @namespace
 926   *
 927   * @since 4.2.0
 928   */
 929  wp.media.audio = {
 930      coerce : wp.media.coerce,
 931  
 932      defaults : {
 933          id : wp.media.view.settings.post.id,
 934          src : '',
 935          loop : false,
 936          autoplay : false,
 937          preload : 'none',
 938          width : 400
 939      },
 940  
 941      /**
 942       * Instantiates a new media object with the next matching shortcode.
 943       *
 944       * @since 4.2.0
 945       *
 946       * @param {string} data The text to apply the shortcode on.
 947       * @return {wp.media} The media object.
 948       */
 949      edit : function( data ) {
 950          var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
 951  
 952          frame = wp.media({
 953              frame: 'audio',
 954              state: 'audio-details',
 955              metadata: _.defaults( shortcode.attrs.named, this.defaults )
 956          });
 957  
 958          return frame;
 959      },
 960  
 961      /**
 962       * Generates an audio shortcode.
 963       *
 964       * @since 4.2.0
 965       *
 966       * @param {Array} model Array with attributes for the shortcode.
 967       * @return {wp.shortcode} The audio shortcode object.
 968       */
 969      shortcode : function( model ) {
 970          var content;
 971  
 972          _.each( this.defaults, function( value, key ) {
 973              model[ key ] = this.coerce( model, key );
 974  
 975              if ( value === model[ key ] ) {
 976                  delete model[ key ];
 977              }
 978          }, this );
 979  
 980          content = model.content;
 981          delete model.content;
 982  
 983          return new wp.shortcode({
 984              tag: 'audio',
 985              attrs: model,
 986              content: content
 987          });
 988      }
 989  };
 990  
 991  /**
 992   * Shortcode modeling for video.
 993   *
 994   *  `edit()` prepares the shortcode for the media modal.
 995   *  `shortcode()` builds the new shortcode after update.
 996   *
 997   * @since 4.2.0
 998   *
 999   * @namespace
1000   */
1001  wp.media.video = {
1002      coerce : wp.media.coerce,
1003  
1004      defaults : {
1005          id : wp.media.view.settings.post.id,
1006          src : '',
1007          poster : '',
1008          loop : false,
1009          autoplay : false,
1010          preload : 'metadata',
1011          content : '',
1012          width : 640,
1013          height : 360
1014      },
1015  
1016      /**
1017       * Instantiates a new media object with the next matching shortcode.
1018       *
1019       * @since 4.2.0
1020       *
1021       * @param {string} data The text to apply the shortcode on.
1022       * @return {wp.media} The media object.
1023       */
1024      edit : function( data ) {
1025          var frame,
1026              shortcode = wp.shortcode.next( 'video', data ).shortcode,
1027              attrs;
1028  
1029          attrs = shortcode.attrs.named;
1030          attrs.content = shortcode.content;
1031  
1032          frame = wp.media({
1033              frame: 'video',
1034              state: 'video-details',
1035              metadata: _.defaults( attrs, this.defaults )
1036          });
1037  
1038          return frame;
1039      },
1040  
1041      /**
1042       * Generates an video shortcode.
1043       *
1044       * @since 4.2.0
1045       *
1046       * @param {Array} model Array with attributes for the shortcode.
1047       * @return {wp.shortcode} The video shortcode object.
1048       */
1049      shortcode : function( model ) {
1050          var content;
1051  
1052          _.each( this.defaults, function( value, key ) {
1053              model[ key ] = this.coerce( model, key );
1054  
1055              if ( value === model[ key ] ) {
1056                  delete model[ key ];
1057              }
1058          }, this );
1059  
1060          content = model.content;
1061          delete model.content;
1062  
1063          return new wp.shortcode({
1064              tag: 'video',
1065              attrs: model,
1066              content: content
1067          });
1068      }
1069  };
1070  
1071  media.model.PostMedia = __webpack_require__( 241 );
1072  media.controller.AudioDetails = __webpack_require__( 1206 );
1073  media.controller.VideoDetails = __webpack_require__( 5039 );
1074  media.view.MediaFrame.MediaDetails = __webpack_require__( 741 );
1075  media.view.MediaFrame.AudioDetails = __webpack_require__( 175 );
1076  media.view.MediaFrame.VideoDetails = __webpack_require__( 8646 );
1077  media.view.MediaDetails = __webpack_require__( 9467 );
1078  media.view.AudioDetails = __webpack_require__( 3713 );
1079  media.view.VideoDetails = __webpack_require__( 5836 );
1080  
1081  })();
1082  
1083  /******/ })()
1084  ;


Generated : Fri Nov 15 08:20:01 2024 Cross-referenced by PHPXref