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

Current speed setting highlighted #6

Open
KieranM55 opened this issue Sep 26, 2020 · 8 comments
Open

Current speed setting highlighted #6

KieranM55 opened this issue Sep 26, 2020 · 8 comments

Comments

@KieranM55
Copy link

First of all, it's a brilliant plugin thank you so much! I use it for my Guitar Practice Website to slow down exercises for students to play along with which is very powerful.

A bit of feedback I'm getting is that it would be handy for the currently selected speed to be highlighted on the player (maybe a coloured circle or bold writing?) - I had a look through your plugin description, and sorry my coding/Wordpress experience is very basic so I wasn't able to figure out if you already had documented how to do this, is it possible with the current plugin?

I've been able to edit the speed options to suit, using 60/70/80/90/100% as the buttons and they work really well, and the highlighted button would be the icing on the cake if possible, thank you!

@Lewiscowles1986
Copy link

Lewiscowles1986 commented Sep 27, 2020

Thanks Kieran. I actually have a sister plugin for just that, but you can even use the theme editor custom CSS (if your theme supports) or gutenberg custom-html block to add some CSS.

The code for the sister plugin
<?php
/**
 * Plugin Name: Media Playback Speed Highlight
 * Description: Highlights playback-rate buttons red when selected.
 * Author: Lewis Cowles
 * Version: 1.0.0
 */

add_action( 'wp_enqueue_scripts', function(){
  wp_enqueue_script( 'jquery' );
});
add_action( 'wp_footer', function() {
  $default_css = [["name"=>"color","value"=>"red","important"=>true]];
  $css = apply_filters('media-playback-speed-highlight-css', $default_css);
?>
<style>
.playback-rate-button.mejs-active {
<?php foreach($css as $rule): ?>
  <?php echo $rule['name']; ?>: <?php echo $rule['value']; ?> <?php echo (($rule['important'] == true) ? '!important' : ''); ?>
<?php endforeach; ?>
}
</style>

<?php

The selector to change text colour to red is basically

.playback-rate-button.mejs-active {
    color: red !important;
}

You can use any CSS that works for your audience though.

If you do put it in a custom HTML block, put the CSS between <style> tags.

The point of the sister plugin is to allow further filters to contextually (by category, tag, or post, using the media-playback-speed-highlight-css filter, and editing an array) to specify separate colours. If you want a single colour, the CSS added to your theme or post is easiest to think about.

Hope this helps, and thank you for letting me know about your use case for the plugin.

@KieranM55
Copy link
Author

KieranM55 commented Sep 28, 2020 via email

@KieranM55
Copy link
Author

KieranM55 commented Sep 29, 2020 via email

@Lewiscowles1986
Copy link

Hi Kieran,

The following is the only thing you would paste into custom CSS

.playback-rate-button.mejs-active {
    color: red !important;
}

I take it you tried pasting the plugin code into the CSS box?

Can you share a screenshot (and use GitHub instead of email)?

@KieranM55
Copy link
Author

Media Playback Speed - Red Number Highlighted is flashing

Hey Lewis,

Thanks for the update, so I've now pasted just that code into my 'Additional CSS' area and it has worked! I can now see the red highlighted buttons for the speed option highlighted which is a big help.

I've tested it on both Chrome and Firefox on my PC, as well as Chrome on my Android phone, and the only thing I've spotted is that on Chrome on my PC, the red numbers are flashing after I hit play? Most of the surrounding audio files also have the red '100%' flashing as well after play is hit. This does not happen on Firefox or on my phone.

Sorry I can't share a video here, and my website has a password login, but I've attached a screenshot where you can see the different shades of red as it is flashing. It's not a deal breaker as the red flashing is definitely better than no highlight, but could just be distracting for the student, just wanted to let you know if you had a thought on what I might need to change at all?

Thanks very much again for your help!

Kieran

@Lewiscowles1986
Copy link

Hi Kieran,

There is nothing that should be making it flash in the code. Perhaps it is the theme in some way, or some other CSS changes?

I'd first try changing theme to an official one like storefront or 2012-2020 with only this plugin enabled (maybe on a dev site), with the theme edit.

If that solves the issue, one by one turn things back on until you see the flashing, and you'll have your culprit.

Best,
Lewis

@KieranM55
Copy link
Author

Hi Lewis,

I think you're right, it will definitely be something on my end that I'll have a look into.

I've already had some great comments about the highlighted speed so thanks very much again!!

Kieran

@CODESIGN2 CODESIGN2 locked and limited conversation to collaborators Oct 1, 2020
@Lewiscowles1986
Copy link

Sibling plugin

media-playback-speed-highlight.zip

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

No branches or pull requests

2 participants