MCPcopy Index your code
hub / github.com/ampproject/amphtml / createFakeVideoPlayerClass

Function createFakeVideoPlayerClass

test/integration/test-video-manager.js:456–615  ·  view source on GitHub ↗
(win)

Source from the content-addressed store, hash-verified

454 });
455
456function createFakeVideoPlayerClass(win) {
457 /**
458 * @implements {../../src/video-interface.VideoInterface}
459 */
460 return class FakeVideoPlayer extends win.AMP.BaseElement {
461 /** @param {!AmpElement} element */
462 constructor(element) {
463 super(element);
464
465 /** @private @const */
466 this.timer_ = Services.timerFor(this.win);
467
468 /** @private @const */
469 this.length_ = 10000;
470
471 /** @private @const */
472 this.duration_ = 10;
473
474 /** @private */
475 this.currentTime_ = 0;
476
477 /** @private */
478 this.timeoutId_ = null;
479 }
480
481 /** @override */
482 isLayoutSupported(layout) {
483 return isLayoutSizeDefined(layout);
484 }
485
486 /** @override */
487 buildCallback() {
488 const ampdoc = Services.ampdocServiceFor(this.win).getSingleDoc();
489 installVideoManagerForDoc(ampdoc);
490 Services.videoManagerForDoc(this.win.document).register(this);
491 }
492
493 /** @override */
494 layoutCallback() {
495 const iframe = this.element.ownerDocument.createElement('iframe');
496 this.element.appendChild(iframe);
497
498 return Promise.resolve().then(() => {
499 dispatchCustomEvent(this.element, VideoEvents_Enum.LOAD);
500 });
501 }
502
503 // VideoInterface Implementation. See ../src/video-interface.VideoInterface
504
505 /**
506 * @override
507 */
508 supportsPlatform() {
509 return true;
510 }
511
512 /**
513 * @override

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected