Skip to content

mat-tab-group stops audio/video player on tab leave #17391

Closed
@iiiyx

Description

@iiiyx

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/angular-otmu5c

Steps to reproduce:

  1. start the audio player on the Player tab
  2. go to the Description tab

Expected Behavior

Audio continues playing

Actual Behavior

Audio stops

Environment

  • Angular: 8.2.10
  • CDK/Material: 8.2.3
  • Browser(s): Chrome 77.0.3865.120
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Description

Certainly, this is a premature optimization made at

/** Set initial visibility or set up subscription for changing visibility. */
ngOnInit(): void {
super.ngOnInit();
this._centeringSub = this._host._beforeCentering
.pipe(startWith(this._host._isCenterPosition(this._host._position)))
.subscribe((isCentering: boolean) => {
if (isCentering && !this.hasAttached()) {
this.attach(this._host._content);
}
});
this._leavingSub = this._host._afterLeavingCenter.subscribe(() => {
this.detach();
});
}

Why are you detaching the content of the tab even when a component's user doesn't ask to?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/tabsfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions