[ 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      /**
 563       * Initializes the media details view.
 564       */
 565      initialize: function() {
 566          _.bindAll(this, 'success');
 567          this.players = [];
 568          this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers );
 569          this.on( 'ready', this.setPlayer );
 570          this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
 571          this.on( 'media:setting:remove', this.render );
 572          this.on( 'media:setting:remove', this.setPlayer );
 573  
 574          AttachmentDisplay.prototype.initialize.apply( this, arguments );
 575      },
 576  
 577      /**
 578       * Handles events for the media details view.
 579       *
 580       * @return {Object} The events object.
 581       */
 582      events: function(){
 583          return _.extend( {
 584              'click .remove-setting' : 'removeSetting',
 585              'change .content-track' : 'setTracks',
 586              'click .remove-track' : 'setTracks',
 587              'click .add-media-source' : 'addSource'
 588          }, AttachmentDisplay.prototype.events );
 589      },
 590  
 591      /**
 592       * Prepares the data for the media details view.
 593       *
 594       * @return {Object} The prepared data.
 595       */
 596      prepare: function() {
 597          return _.defaults({
 598              model: this.model.toJSON()
 599          }, this.options );
 600      },
 601  
 602      /**
 603       * Removes a setting's UI when the model unsets it
 604       *
 605       * Fires `wp.media.view.MediaDetails#media:setting:remove` when a setting is removed.
 606       *
 607       * @param {JQuery.Event} e The jQuery event object.
 608       */
 609      removeSetting : function(e) {
 610          var wrap = $( e.currentTarget ).parent(), setting;
 611          setting = wrap.find( 'input' ).data( 'setting' );
 612  
 613          if ( setting ) {
 614              this.model.unset( setting );
 615              this.trigger( 'media:setting:remove', this );
 616          }
 617  
 618          wrap.remove();
 619      },
 620  
 621      /**
 622       * Sets the tracks for the media details view.
 623       *
 624       * Fires `wp.media.view.MediaDetails#media:setting:remove` when the tracks are updated.
 625       */
 626      setTracks : function() {
 627          var tracks = '';
 628  
 629          _.each( this.$('.content-track'), function(track) {
 630              tracks += $( track ).val();
 631          } );
 632  
 633          this.model.set( 'content', tracks );
 634          this.trigger( 'media:setting:remove', this );
 635      },
 636  
 637      /**
 638       * Adds a source to the media details view.
 639       *
 640       * @param {JQuery.Event} e The jQuery event object.
 641       */
 642      addSource : function( e ) {
 643          this.controller.lastMime = $( e.currentTarget ).data( 'mime' );
 644          this.controller.setState( 'add-' + this.controller.defaults.id + '-source' );
 645      },
 646  
 647      /**
 648       * Loads the media player for the media details view.
 649       */
 650      loadPlayer: function () {
 651          this.players.push( new MediaElementPlayer( this.media, this.settings ) );
 652          this.scriptXhr = false;
 653      },
 654  
 655      /**
 656       * Sets the media player for the media details view.
 657       */
 658      setPlayer : function() {
 659          var src;
 660  
 661          if ( this.players.length || ! this.media || this.scriptXhr ) {
 662              return;
 663          }
 664  
 665          src = this.model.get( 'src' );
 666  
 667          if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) {
 668              this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) );
 669          } else {
 670              this.loadPlayer();
 671          }
 672      },
 673  
 674      /**
 675       * Sets the media for the media details view.
 676       *
 677       * @abstract
 678       */
 679      setMedia : function() {
 680          return this;
 681      },
 682  
 683      /**
 684       * Handles the success event for the media details view.
 685       *
 686       * @param {MediaElementPlayer} mejs The media element player instance.
 687       */
 688      success : function(mejs) {
 689          var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
 690  
 691          if ( 'flash' === mejs.pluginType && autoplay ) {
 692              mejs.addEventListener( 'canplay', function() {
 693                  mejs.play();
 694              }, false );
 695          }
 696  
 697          this.mejs = mejs;
 698      },
 699  
 700      /**
 701       * Renders the media details view.
 702       *
 703       * @return {wp.media.view.MediaDetails} Returns itself to allow chaining.
 704       */
 705      render: function() {
 706          AttachmentDisplay.prototype.render.apply( this, arguments );
 707  
 708          setTimeout( _.bind( function() {
 709              this.scrollToTop();
 710          }, this ), 10 );
 711  
 712          this.settings = _.defaults( {
 713              success : this.success
 714          }, wp.media.mixin.mejsSettings );
 715  
 716          return this.setMedia();
 717      },
 718  
 719      /**
 720       * Scrolls the media details view to the top.
 721       */
 722      scrollToTop: function() {
 723          this.$( '.embed-media-settings' ).scrollTop( 0 );
 724      }
 725  },/** @lends wp.media.view.MediaDetails */{
 726      instances : 0,
 727      /**
 728       * When multiple players in the DOM contain the same src, things get weird.
 729       *
 730       * @param {HTMLElement} elem The HTML element containing the media sources to be prepared.
 731       * @return {HTMLElement} The prepared element.
 732       */
 733      prepareSrc : function( elem ) {
 734          var i = MediaDetails.instances++;
 735          _.each( $( elem ).find( 'source' ), function( source ) {
 736              source.src = [
 737                  source.src,
 738                  source.src.indexOf('?') > -1 ? '&' : '?',
 739                  '_=',
 740                  i
 741              ].join('');
 742          } );
 743  
 744          return elem;
 745      }
 746  });
 747  
 748  module.exports = MediaDetails;
 749  
 750  
 751  /***/ },
 752  
 753  /***/ 5836
 754  (module) {
 755  
 756  var MediaDetails = wp.media.view.MediaDetails,
 757      VideoDetails;
 758  
 759  /**
 760   * wp.media.view.VideoDetails
 761   *
 762   * @memberOf wp.media.view
 763   *
 764   * @class
 765   * @augments wp.media.view.MediaDetails
 766   * @augments wp.media.view.Settings.AttachmentDisplay
 767   * @augments wp.media.view.Settings
 768   * @augments wp.media.View
 769   * @augments wp.Backbone.View
 770   * @augments Backbone.View
 771   */
 772  VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{
 773      className: 'video-details',
 774      template:  wp.template('video-details'),
 775  
 776      setMedia: function() {
 777          var video = this.$('.wp-video-shortcode');
 778  
 779          if ( video.find( 'source' ).length ) {
 780              if ( video.is(':hidden') ) {
 781                  video.show();
 782              }
 783  
 784              if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) {
 785                  this.media = MediaDetails.prepareSrc( video.get(0) );
 786              } else {
 787                  this.media = video.get(0);
 788              }
 789          } else {
 790              video.hide();
 791              this.media = false;
 792          }
 793  
 794          return this;
 795      }
 796  });
 797  
 798  module.exports = VideoDetails;
 799  
 800  
 801  /***/ }
 802  
 803  /******/     });
 804  /************************************************************************/
 805  /******/     // The module cache
 806  /******/     const __webpack_module_cache__ = {};
 807  /******/     
 808  /******/     // The require function
 809  /******/ 	function __webpack_require__(moduleId) {
 810  /******/         // Check if module is in cache
 811  /******/         const cachedModule = __webpack_module_cache__[moduleId];
 812  /******/         if (cachedModule !== undefined) {
 813  /******/             return cachedModule.exports;
 814  /******/         }
 815  /******/         // Create a new module (and put it into the cache)
 816  /******/         const module = __webpack_module_cache__[moduleId] = {
 817  /******/             // no module.id needed
 818  /******/             // no module.loaded needed
 819  /******/             exports: {}
 820  /******/         };
 821  /******/     
 822  /******/         // Execute the module function
 823  /******/         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 824  /******/     
 825  /******/         // Return the exports of the module
 826  /******/         return module.exports;
 827  /******/     }
 828  /******/     
 829  /************************************************************************/
 830  /**
 831   * @output wp-includes/js/media-audiovideo.js
 832   */
 833  
 834  var media = wp.media,
 835      baseSettings = window._wpmejsSettings || {},
 836      l10n = window._wpMediaViewsL10n || {};
 837  
 838  /**
 839   * Defines the wp.media.mixin object.
 840   *
 841   * @mixin
 842   *
 843   * @since 4.2.0
 844   */
 845  wp.media.mixin = {
 846      mejsSettings: baseSettings,
 847  
 848      /**
 849       * Pauses and removes all players.
 850       *
 851       * @since 4.2.0
 852       *
 853       * @return {void}
 854       */
 855      removeAllPlayers: function() {
 856          var p;
 857  
 858          if ( window.mejs && window.mejs.players ) {
 859              for ( p in window.mejs.players ) {
 860                  window.mejs.players[p].pause();
 861                  this.removePlayer( window.mejs.players[p] );
 862              }
 863          }
 864      },
 865  
 866      /**
 867       * Removes the player.
 868       *
 869       * Override the MediaElement method for removing a player.
 870       * MediaElement tries to pull the audio/video tag out of
 871       * its container and re-add it to the DOM.
 872       *
 873       * @since 4.2.0
 874       *
 875       * @param {Object} t The MediaElement player object.
 876       * @return {void}
 877       */
 878      removePlayer: function(t) {
 879          var featureIndex, feature;
 880  
 881          if ( ! t.options ) {
 882              return;
 883          }
 884  
 885          // Invoke features cleanup.
 886          for ( featureIndex in t.options.features ) {
 887              feature = t.options.features[featureIndex];
 888              if ( t['clean' + feature] ) {
 889                  try {
 890                      t['clean' + feature](t);
 891                  } catch (e) {}
 892              }
 893          }
 894  
 895          if ( ! t.isDynamic ) {
 896              t.node.remove();
 897          }
 898  
 899          if ( 'html5' !== t.media.rendererName ) {
 900              t.media.remove();
 901          }
 902  
 903          delete window.mejs.players[t.id];
 904  
 905          t.container.remove();
 906          t.globalUnbind('resize', t.globalResizeCallback);
 907          t.globalUnbind('keydown', t.globalKeydownCallback);
 908          t.globalUnbind('click', t.globalClickCallback);
 909          delete t.media.player;
 910      },
 911  
 912      /**
 913       * Removes and resets all players.
 914       *
 915       * Allows any class that has set 'player' to a MediaElementPlayer
 916       * instance to remove the player when listening to events.
 917       *
 918       * Examples: modal closes, shortcode properties are removed, etc.
 919       *
 920       * @since 4.2.0
 921       */
 922      unsetPlayers : function() {
 923          if ( this.players && this.players.length ) {
 924              _.each( this.players, function (player) {
 925                  player.pause();
 926                  wp.media.mixin.removePlayer( player );
 927              } );
 928              this.players = [];
 929          }
 930      }
 931  };
 932  
 933  /**
 934   * Shortcode modeling for playlists.
 935   *
 936   * @since 4.2.0
 937   */
 938  wp.media.playlist = new wp.media.collection({
 939      tag: 'playlist',
 940      editTitle : l10n.editPlaylistTitle,
 941      defaults : {
 942          id: wp.media.view.settings.post.id,
 943          style: 'light',
 944          tracklist: true,
 945          tracknumbers: true,
 946          images: true,
 947          artists: true,
 948          type: 'audio'
 949      }
 950  });
 951  
 952  /**
 953   * Shortcode modeling for audio.
 954   *
 955   * `edit()` prepares the shortcode for the media modal.
 956   * `shortcode()` builds the new shortcode after an update.
 957   *
 958   * @namespace
 959   *
 960   * @since 4.2.0
 961   */
 962  wp.media.audio = {
 963      coerce : wp.media.coerce,
 964  
 965      defaults : {
 966          id : wp.media.view.settings.post.id,
 967          src : '',
 968          loop : false,
 969          autoplay : false,
 970          preload : 'none',
 971          width : 400
 972      },
 973  
 974      /**
 975       * Instantiates a new media object with the next matching shortcode.
 976       *
 977       * @since 4.2.0
 978       *
 979       * @param {string} data The text to apply the shortcode on.
 980       * @return {wp.media} The media object.
 981       */
 982      edit : function( data ) {
 983          var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
 984  
 985          frame = wp.media({
 986              frame: 'audio',
 987              state: 'audio-details',
 988              metadata: _.defaults( shortcode.attrs.named, this.defaults )
 989          });
 990  
 991          return frame;
 992      },
 993  
 994      /**
 995       * Generates an audio shortcode.
 996       *
 997       * @since 4.2.0
 998       *
 999       * @param {Array} model Array with attributes for the shortcode.
1000       * @return {wp.shortcode} The audio shortcode object.
1001       */
1002      shortcode : function( model ) {
1003          var content;
1004  
1005          _.each( this.defaults, function( value, key ) {
1006              model[ key ] = this.coerce( model, key );
1007  
1008              if ( value === model[ key ] ) {
1009                  delete model[ key ];
1010              }
1011          }, this );
1012  
1013          content = model.content;
1014          delete model.content;
1015  
1016          return new wp.shortcode({
1017              tag: 'audio',
1018              attrs: model,
1019              content: content
1020          });
1021      }
1022  };
1023  
1024  /**
1025   * Shortcode modeling for video.
1026   *
1027   * `edit()` prepares the shortcode for the media modal.
1028   * `shortcode()` builds the new shortcode after update.
1029   *
1030   * @since 4.2.0
1031   *
1032   * @namespace
1033   */
1034  wp.media.video = {
1035      coerce : wp.media.coerce,
1036  
1037      defaults : {
1038          id : wp.media.view.settings.post.id,
1039          src : '',
1040          poster : '',
1041          loop : false,
1042          autoplay : false,
1043          preload : 'metadata',
1044          content : '',
1045          width : 640,
1046          height : 360
1047      },
1048  
1049      /**
1050       * Instantiates a new media object with the next matching shortcode.
1051       *
1052       * @since 4.2.0
1053       *
1054       * @param {string} data The text to apply the shortcode on.
1055       * @return {wp.media} The media object.
1056       */
1057      edit : function( data ) {
1058          var frame,
1059              shortcode = wp.shortcode.next( 'video', data ).shortcode,
1060              attrs;
1061  
1062          attrs = shortcode.attrs.named;
1063          attrs.content = shortcode.content;
1064  
1065          frame = wp.media({
1066              frame: 'video',
1067              state: 'video-details',
1068              metadata: _.defaults( attrs, this.defaults )
1069          });
1070  
1071          return frame;
1072      },
1073  
1074      /**
1075       * Generates an video shortcode.
1076       *
1077       * @since 4.2.0
1078       *
1079       * @param {Array} model Array with attributes for the shortcode.
1080       * @return {wp.shortcode} The video shortcode object.
1081       */
1082      shortcode : function( model ) {
1083          var content;
1084  
1085          _.each( this.defaults, function( value, key ) {
1086              model[ key ] = this.coerce( model, key );
1087  
1088              if ( value === model[ key ] ) {
1089                  delete model[ key ];
1090              }
1091          }, this );
1092  
1093          content = model.content;
1094          delete model.content;
1095  
1096          return new wp.shortcode({
1097              tag: 'video',
1098              attrs: model,
1099              content: content
1100          });
1101      }
1102  };
1103  
1104  media.model.PostMedia = __webpack_require__( 241 );
1105  media.controller.AudioDetails = __webpack_require__( 1206 );
1106  media.controller.VideoDetails = __webpack_require__( 5039 );
1107  media.view.MediaFrame.MediaDetails = __webpack_require__( 741 );
1108  media.view.MediaFrame.AudioDetails = __webpack_require__( 175 );
1109  media.view.MediaFrame.VideoDetails = __webpack_require__( 8646 );
1110  media.view.MediaDetails = __webpack_require__( 9467 );
1111  media.view.AudioDetails = __webpack_require__( 3713 );
1112  media.view.VideoDetails = __webpack_require__( 5836 );
1113  
1114  /******/ })()
1115  ;


Generated : Mon Oct 19 08:20:34 2026 Cross-referenced by PHPXref