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

Add markers #8

Merged
merged 4 commits into from
Jan 18, 2022
Merged

Add markers #8

merged 4 commits into from
Jan 18, 2022

Conversation

adeeb1
Copy link

@adeeb1 adeeb1 commented Jan 18, 2022

Cherry-picked from the great work done by ForeverSc: https://github.com/ForeverSc/plyr/tree/feat/markers
Pull request in main repo: sampotts#2386

This branch also:

  • Adds getters and setters for markers so they can be dynamically updated on the UI
  • Enables markers to be shown without tooltips
  • Updates the README documentation with markers usage

fengshuo and others added 4 commits January 17, 2022 21:26
@adeeb1 adeeb1 merged commit 7e6de57 into master Jan 18, 2022
@zamoosh
Copy link

zamoosh commented Sep 21, 2022

@adeeb1
Hello Alexander Deeb! I'm trying to find a way to put markers dynamically using a button added to player like this:

image

would you please explain to me how to set markers on a Plyr object? (if there is a specific method to use)
here is my code: let audio = new Plyr('#player1');

thank you! 🙏🏻

@adeeb1
Copy link
Author

adeeb1 commented Sep 21, 2022

@zamoosh Hi! Sure, you can do it by setting the value of the markers attribute:

audio.markers = {
  enabled: true,
  points: markersAry
};

For example:

audio.markers = {
  enabled: true,
  points: [{
    time: 30,
    tipHTML: "<p>Test</p>"
  }]
};

@zamoosh
Copy link

zamoosh commented Sep 21, 2022

@adeeb1
many thanks to you!! 🙏🏻 ☺️

but it's not working yet!
I tried to insert the markers throw inspect, but the label won't show!
like below:
image

would you please see my code?
image

Is it possible to add markers after initialing the object?

@adeeb1
Copy link
Author

adeeb1 commented Sep 21, 2022

@zamoosh This fork deviates from the main API, as we don't use a label key when defining a marker. Please see the markers options under the documentation here: https://github.com/ClassHook/plyr#options

Yes, it is possible to add markers after initializing the object. Try something like this to make sure it works at initializing:

let audio = new Plyr('#player1', {
  markers: {
    enabled: true,
    points: [
      { time: 30, tip: 'Test tip' }
    ]
  }
};

@zamoosh
Copy link

zamoosh commented Sep 21, 2022

@adeeb1
Ohhh...! forgive me! I must use this fork!
sorry for taking you time!

thanks a lot! 🙏🏻 😃

@zamoosh
Copy link

zamoosh commented Sep 21, 2022

@adeeb1
Bro! finally I got the answer! 🎉
thank you!
image

@adeeb1
Copy link
Author

adeeb1 commented Sep 21, 2022

@zamoosh Glad to help! Make sure to use tipHtml instead of tip if you want to display HTML in the tooltip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants