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

Question for Customizing the UI #2005

Closed
Atercatus opened this issue Jun 21, 2019 · 2 comments
Closed

Question for Customizing the UI #2005

Atercatus opened this issue Jun 21, 2019 · 2 comments
Labels
status: archived Archived and locked; will not be updated type: question A question from the community

Comments

@Atercatus
Copy link

I followed the tutorial and got a question.

Could not be found in Customizing the UI the myapp

// skipButton.js

// Use shaka.ui.Element as a base class
myapp.SkipButton = class extends shaka.ui.Element {
  constructor(parent, controls) {
    super(parent, controls);

    // The actual button that will be displayed
    this.button_ = document.createElement('button');
    this.button_.textContent = 'Skip current video';
    this.parent.appendChild(this.button_);

    // Listen for clicks on the button to start the next playback
    this.eventManager.listen(this.button_, 'click', () => {
      let nextManifest = /* Your logic to pick the next video to be played */
        myapp.getNextManifest();

      // shaka.ui.Element gives us access to the player object as member of the class
      this.player.load(nextManifest);
    });
  }
};

// Factory that will create a button at run time.
myapp.SkipButton.Factory = class {
  create(rootElement, controls) {
    return new myapp.SkipButton(rootElement, controls);
  }
};
// Register our factory with the controls, so controls can create button instances.
shaka.ui.Controls.registerElement(
  /* This name will serve as a reference to the button in the UI configuration object */ 'skip',
  new myapp.SkipButton.Factory());

What does myapp mean?

And in 'Changing seek bar progress colors' ,
seek bar color is undefined.
how can i change this color?

console.log(shaka.ui.Controls.SEEK_BAR_BASE_COLOR_) // undefined
shaka.ui.Controls.SEEK_BAR_BASE_COLOR_ , 
shaka.ui.Controls.SEEK_BAR_PLAYED_COLOR_, and 
shaka.ui.Controls.SEEK_BAR_BUFFERED_COLOR_ in ui/controls.js
@Atercatus Atercatus added the type: question A question from the community label Jun 21, 2019
@ismena
Copy link
Contributor

ismena commented Jun 21, 2019

Hi @Atercatus
The tutorial is an example of something you could create with your custom logic. It's not a real button and won't work out of the box!
"myapp" is a placeholder for you application namespace.

For an example of an existing button that already works, please take a look at one of the buttons in https://github.com/google/shaka-player/blob/master/ui/ like the mute button.

If you're interested in creating a custom button, i could coach you through it, though! Did you have a specific button in mind?

For the seek bar color, looks like we did not update the tutorial after the structure of our code changed a bit. I will do that now, thank you for bringing this up!
The new constant for the color is shaka.ui.Constants.SEEK_BAR_BASE_COLOR in ui/constants.js

@Atercatus Atercatus reopened this Jun 22, 2019
@Atercatus
Copy link
Author

I'm really appreciate for reply!
i wanna make next video button , but i don't know how to serve the video from node.js server to shaka player. So, I'll study more and get help again later.

thanks!

shaka-bot pushed a commit that referenced this issue Jun 24, 2019
The seekbar color consts got moved from Controls
to ui.Constants.

Issue #2005.

Change-Id: Id8c09cb59930f2f23a350cb1e7be3c8708c121d7
TheModMaker pushed a commit that referenced this issue Jul 3, 2019
The seekbar color consts got moved from Controls
to ui.Constants.

Issue #2005.

Change-Id: Id8c09cb59930f2f23a350cb1e7be3c8708c121d7
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
The seekbar color consts got moved from Controls
to ui.Constants.

Issue shaka-project#2005.

Change-Id: Id8c09cb59930f2f23a350cb1e7be3c8708c121d7
@shaka-project shaka-project locked and limited conversation to collaborators Aug 21, 2019
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: question A question from the community
Projects
None yet
Development

No branches or pull requests

3 participants