[ 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
 606       *
 607       * @param {Event} e
 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
 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 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
 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   *
 840   * Defines the wp.media.mixin object.
 841   *
 842   * @mixin
 843   *
 844   * @since 4.2.0
 845   */
 846  wp.media.mixin = {
 847      mejsSettings: baseSettings,
 848  
 849      /**
 850       * Pauses and removes all players.
 851       *
 852       * @since 4.2.0
 853       *
 854       * @return {void}
 855       */
 856      removeAllPlayers: function() {
 857          var p;
 858  
 859          if ( window.mejs && window.mejs.players ) {
 860              for ( p in window.mejs.players ) {
 861                  window.mejs.players[p].pause();
 862                  this.removePlayer( window.mejs.players[p] );
 863              }
 864          }
 865      },
 866  
 867      /**
 868       * Removes the player.
 869       *
 870       * Override the MediaElement method for removing a player.
 871       * MediaElement tries to pull the audio/video tag out of
 872       * its container and re-add it to the DOM.
 873       *
 874       * @since 4.2.0
 875       *
 876       * @param {Object} t The MediaElement player object.
 877       * @return {void}
 878       */
 879      removePlayer: function(t) {
 880          var featureIndex, feature;
 881  
 882          if ( ! t.options ) {
 883              return;
 884          }
 885  
 886          // Invoke features cleanup.
 887          for ( featureIndex in t.options.features ) {
 888              feature = t.options.features[featureIndex];
 889              if ( t['clean' + feature] ) {
 890                  try {
 891                      t['clean' + feature](t);
 892                  } catch (e) {}
 893              }
 894          }
 895  
 896          if ( ! t.isDynamic ) {
 897              t.node.remove();
 898          }
 899  
 900          if ( 'html5' !== t.media.rendererName ) {
 901              t.media.remove();
 902          }
 903  
 904          delete window.mejs.players[t.id];
 905  
 906          t.container.remove();
 907          t.globalUnbind('resize', t.globalResizeCallback);
 908          t.globalUnbind('keydown', t.globalKeydownCallback);
 909          t.globalUnbind('click', t.globalClickCallback);
 910          delete t.media.player;
 911      },
 912  
 913      /**
 914       *
 915       * Removes and resets all players.
 916       *
 917       * Allows any class that has set 'player' to a MediaElementPlayer
 918       * instance to remove the player when listening to events.
 919       *
 920       * Examples: modal closes, shortcode properties are removed, etc.
 921       *
 922       * @since 4.2.0
 923       */
 924      unsetPlayers : function() {
 925          if ( this.players && this.players.length ) {
 926              _.each( this.players, function (player) {
 927                  player.pause();
 928                  wp.media.mixin.removePlayer( player );
 929              } );
 930              this.players = [];
 931          }
 932      }
 933  };
 934  
 935  /**
 936   * Shortcode modeling for playlists.
 937   *
 938   * @since 4.2.0
 939   */
 940  wp.media.playlist = new wp.media.collection({
 941      tag: 'playlist',
 942      editTitle : l10n.editPlaylistTitle,
 943      defaults : {
 944          id: wp.media.view.settings.post.id,
 945          style: 'light',
 946          tracklist: true,
 947          tracknumbers: true,
 948          images: true,
 949          artists: true,
 950          type: 'audio'
 951      }
 952  });
 953  
 954  /**
 955   * Shortcode modeling for audio.
 956   *
 957   * `edit()` prepares the shortcode for the media modal.
 958   * `shortcode()` builds the new shortcode after an update.
 959   *
 960   * @namespace
 961   *
 962   * @since 4.2.0
 963   */
 964  wp.media.audio = {
 965      coerce : wp.media.coerce,
 966  
 967      defaults : {
 968          id : wp.media.view.settings.post.id,
 969          src : '',
 970          loop : false,
 971          autoplay : false,
 972          preload : 'none',
 973          width : 400
 974      },
 975  
 976      /**
 977       * Instantiates a new media object with the next matching shortcode.
 978       *
 979       * @since 4.2.0
 980       *
 981       * @param {string} data The text to apply the shortcode on.
 982       * @return {wp.media} The media object.
 983       */
 984      edit : function( data ) {
 985          var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
 986  
 987          frame = wp.media({
 988              frame: 'audio',
 989              state: 'audio-details',
 990              metadata: _.defaults( shortcode.attrs.named, this.defaults )
 991          });
 992  
 993          return frame;
 994      },
 995  
 996      /**
 997       * Generates an audio shortcode.
 998       *
 999       * @since 4.2.0
1000       *
1001       * @param {Array} model Array with attributes for the shortcode.
1002       * @return {wp.shortcode} The audio shortcode object.
1003       */
1004      shortcode : function( model ) {
1005          var content;
1006  
1007          _.each( this.defaults, function( value, key ) {
1008              model[ key ] = this.coerce( model, key );
1009  
1010              if ( value === model[ key ] ) {
1011                  delete model[ key ];
1012              }
1013          }, this );
1014  
1015          content = model.content;
1016          delete model.content;
1017  
1018          return new wp.shortcode({
1019              tag: 'audio',
1020              attrs: model,
1021              content: content
1022          });
1023      }
1024  };
1025  
1026  /**
1027   * Shortcode modeling for video.
1028   *
1029   *  `edit()` prepares the shortcode for the media modal.
1030   *  `shortcode()` builds the new shortcode after update.
1031   *
1032   * @since 4.2.0
1033   *
1034   * @namespace
1035   */
1036  wp.media.video = {
1037      coerce : wp.media.coerce,
1038  
1039      defaults : {
1040          id : wp.media.view.settings.post.id,
1041          src : '',
1042          poster : '',
1043          loop : false,
1044          autoplay : false,
1045          preload : 'metadata',
1046          content : '',
1047          width : 640,
1048          height : 360
1049      },
1050  
1051      /**
1052       * Instantiates a new media object with the next matching shortcode.
1053       *
1054       * @since 4.2.0
1055       *
1056       * @param {string} data The text to apply the shortcode on.
1057       * @return {wp.media} The media object.
1058       */
1059      edit : function( data ) {
1060          var frame,
1061              shortcode = wp.shortcode.next( 'video', data ).shortcode,
1062              attrs;
1063  
1064          attrs = shortcode.attrs.named;
1065          attrs.content = shortcode.content;
1066  
1067          frame = wp.media({
1068              frame: 'video',
1069              state: 'video-details',
1070              metadata: _.defaults( attrs, this.defaults )
1071          });
1072  
1073          return frame;
1074      },
1075  
1076      /**
1077       * Generates an video shortcode.
1078       *
1079       * @since 4.2.0
1080       *
1081       * @param {Array} model Array with attributes for the shortcode.
1082       * @return {wp.shortcode} The video shortcode object.
1083       */
1084      shortcode : function( model ) {
1085          var content;
1086  
1087          _.each( this.defaults, function( value, key ) {
1088              model[ key ] = this.coerce( model, key );
1089  
1090              if ( value === model[ key ] ) {
1091                  delete model[ key ];
1092              }
1093          }, this );
1094  
1095          content = model.content;
1096          delete model.content;
1097  
1098          return new wp.shortcode({
1099              tag: 'video',
1100              attrs: model,
1101              content: content
1102          });
1103      }
1104  };
1105  
1106  media.model.PostMedia = __webpack_require__( 241 );
1107  media.controller.AudioDetails = __webpack_require__( 1206 );
1108  media.controller.VideoDetails = __webpack_require__( 5039 );
1109  media.view.MediaFrame.MediaDetails = __webpack_require__( 741 );
1110  media.view.MediaFrame.AudioDetails = __webpack_require__( 175 );
1111  media.view.MediaFrame.VideoDetails = __webpack_require__( 8646 );
1112  media.view.MediaDetails = __webpack_require__( 9467 );
1113  media.view.AudioDetails = __webpack_require__( 3713 );
1114  media.view.VideoDetails = __webpack_require__( 5836 );
1115  
1116  /******/ })()
1117  ;


Generated : Tue Sep 8 08:20:28 2026 Cross-referenced by PHPXref