Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the subtitle to get on top of the play control bar when it is shown? #6672

Open
MarianoFacundoArch opened this issue May 24, 2024 · 6 comments
Labels
status: waiting on response Waiting on a response from the reporter(s) of the issue type: question A question from the community

Comments

@MarianoFacundoArch
Copy link
Contributor

MarianoFacundoArch commented May 24, 2024

image

I see this when loading subtitles with the latest shaka version (4.8.5).

I am trying to look at what might be causing this, but I do not have any clues about how to get the appropriate behavior, as I am doing nothing strange other than adding the text tracks and loading the Shaka player UI.

Could you please guide me on where I should be observing the expected behavior of the subtitles?
Any help would be greatly appreciated!
Thanks

@MarianoFacundoArch MarianoFacundoArch added the type: question A question from the community label May 24, 2024
@MarianoFacundoArch
Copy link
Contributor Author

Doing further research and comparing, for some reason in my setup the shaka-text-container is not even being created.

@MarianoFacundoArch
Copy link
Contributor Author

I am using:

    this._shakaPlayerInstance = new shaka.Player();
    await this._shakaPlayerInstance.attach(this._videoPlayerElement);

    this._shakaPlayerInstance.setVideoContainer(
      this._videoPlayerElement.parentElement
    );

      await this._shakaPlayerInstance.load(
        contenthere
      );

But the text container is not created.

@MarianoFacundoArch
Copy link
Contributor Author

Good and bad news. First the good, I fixed the problem on the text container not being created appropriately; documentation is not OK I guess @avelad

To make it work, you must set the videoContainer before calling the attach method.

    this._shakaPlayerInstance = new shaka.Player();

    this._shakaPlayerInstance.setVideoContainer(
      this._videoPlayerElement.parentElement
    );
    await this._shakaPlayerInstance.attach(this._videoPlayerElement);

The documentation states to do the setVideoContainer before the load, but it has to be done before the attach.

However, the problem now is that it doesn't go up when the controls are shown.
Compared with another code that works, it applies the following css class:
image

But it does not in the player i have with the fixed I quoted.

@MarianoFacundoArch
Copy link
Contributor Author

Finally found the whole problem - I think we need to work on how to fix this.

image

As the only way to get the text container created appropriately is before the attach method, at that time the UI does not exist. So the shaka-text-container is added, as you can see in the image at the very top of the div DOM.
After that, we add and configure the UI, so the UI element is put after the shaka-text-container DOM. Because the styling is applied based on the shown condition of the shaka-controls-container, it does not apply unless the shaka-controls-container is before the shaka-text-container .

I am not really sure what approach we should work on, @avelad @joeyparrish , if we should fix the setVideoContainer method so that it would work if we call it before the load() in order to have the UI set up appropriately before, or if we should keep as it is now, update the documentation and tutorials to make it clear that it has to be called before the attach method and then fix the UI so that it is added before the text-container.

I hope we can benefit from your broad expertise here.

Mariano.

@avelad
Copy link
Collaborator

avelad commented Jun 26, 2024

@MarianoFacundoArch I updated the documentation about attach process

@shaka-bot
Copy link
Collaborator

@MarianoFacundoArch Does this answer all your questions? If so, would you please close the issue?

@shaka-bot shaka-bot added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting on response Waiting on a response from the reporter(s) of the issue type: question A question from the community
Projects
None yet
Development

No branches or pull requests

3 participants