Thanks for the brilliant module to make the player completely accessible by keyboard.

Currently the JS library turns all of the relevant links into player. It would be great if we can allow user to choose which link need to be converted into player and leave other links as default.

Patch coming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rli’s picture

Status: Active » Needs review
FileSize
6.53 KB

This patch altered the default jquery.loader.js file to receive parameter from the UI.

User can set class name in configuration page, and the JS will only convert the links with same class name into the media player, which gives user more control of this feature.

rli’s picture

fix some words and add feature to all kinds of media links.

opdavies’s picture

Thanks for the patch. Just to clarify, I no longer work for Nomensa, so I wouldn't feel right making any further changes to the module without their prior approval. I've sent an email so hopefully I or someone else will be committing your patch soon.

In the meantime, I will review the patch on my own site and report back.

danghoaiphuc’s picture

Yes, thanks for a great module, especially for non-tech people like me. What do you think if we can have a feature as a block to show the player and file links are still kept as they are. I am helping a library site for the blind users and they prefer to download the files instead of streaming online. However, they would like to have a player to help them hear a bit of the file before downloading. I am using screen reader and cannot find the link to download when enable the module.
For the moment, if you have any ideas on how to customize the code to add this option, please help. Thanks

opdavies’s picture

@danghoaiphuc, it all depends in what way you're using the player. If you're using it to stream YouTube videos, then you won't be able to download them. Please create a new issue for this, using the feature request category.

Thanks.

rli’s picture

@danghoaiphuc, this patch can give you the choice to have a player and download link by assigning the class to the link. But like @opdavies said, it depends on the source. It won't be downloadable if it is youtube video.

danghoaiphuc’s picture

Thanks @opdavies and @rli. Will post a new feature request. Our file host is on 4shared.com and wee have the direct links to download files from there. So we just copy those direct download links from 4shared and paste into our website. If so, does it work with your patch, @rli? Thanks.

rli’s picture

@danghoaiphuc, If your path is like 'http://4share.com/test.mp4', the player will be able to pick it up. To make it available for the player, you will need to put a link like <a class='your class' href='http://4share.com/test.mp4'>test</a>. Any links without your class name will be just a normal link to the file.

Stephen Ollman’s picture

Issue summary: View changes

Works beautifully for D7.

Is there a D6 version of the patch?

  • Commit d1c1364 on 7.x-1.x authored by rli, committed by opdavies:
    Issue #2035311 by rli: Option to display media player instead of link.
    
opdavies’s picture

Status: Needs review » Needs work

@rli: I've committed the patch to 7.x-1.x, and fixed an "undefined index" notice that was appearing if the admin form hadn't been submitted so the class name wasn't defined.

However, if I add a class of "player3" rather than just "player", the player still loads. Setting it to something else like "foo" (that doesn't have "player" in it) prevents the player from loading.

rli’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
2.11 KB

Hi opdavies,

I have done following changes:

  • fixed the 'player3' problem by removing '*' in the JS selector.
  • fixed the problem of media file (mp4, flv, ogv) not being picked up.
  • fixed the JS error in config page if nomensa_amp library is bot placed in libraries folder.

Cheers

opdavies’s picture

opdavies’s picture

Committed. Thanks!

opdavies’s picture

Status: Needs review » Fixed

  • Commit 0822456 on 7.x-1.x authored by rli, committed by opdavies:
    Issue #2035311 by rli: Option to display media player instead of link.
    
opdavies’s picture

@rli: Would it be possible to change this around, and add a class of .no-player instead to prevent the player from loading rather than the other way around? The inverse way means that sites currently using the module won't all suddenly stop working, and we're not deviating away from the standard functionality of the player.

rli’s picture

Agreed, it would be hard to manage the code when nomensa library is updated. Better to leave nomensa lib untouched and we do the magic in the module. Will think about it.

opdavies’s picture

Status: Fixed » Needs work

  • opdavies committed cc6a722 on 7.x-1.x
    Revert "Issue #2035311 by rli: Option to display media player instead of...
joachim’s picture

+++ b/nomensa_amp.module
@@ -130,3 +136,11 @@ function nomensa_amp_requirements($phase) {
+
+/**
+ * Implement hook_js_alter()
+ */
+function nomensa_amp_js_alter(&$javascript) {
+  $file = drupal_get_path('module', 'nomensa_amp') . '/nomensa_amp.jquery.loader.js';
+  $javascript['sites/all/libraries/nomensa_amp/custom/javascript/jquery.loader.js'] = drupal_js_defaults($file);
+}

It looks like this is replacing the JS file from the NomensaAMP library with a copy that is now in this module.

I assume the reason for this is that the module's copy differs from the NomensaAMP library version.

This approach strikes me as a very bad idea.

  • opdavies committed 531ed56 on 7.x-1.x
    Revert "Issue #2035311 by rli: Option to display media player instead of...
opdavies’s picture

Status: Needs work » Closed (works as designed)

It looks like this is replacing the JS file from the NomensaAMP library with a copy that is now in this module.

I assume the reason for this is that the module's copy differs from the NomensaAMP library version.

This approach strikes me as a very bad idea.

Thanks for pointing this out, and I agree completely. Two commits for this were causing #2389975: Javascript breaks across site in latest version, so are no longer present in the 7.x-1.4 release.

Any changes to the player functionality should be made upstream by forking the media player repository on GitHub and submitting a pull request, so I'm marking this issue as "works as designed". An issue can then be created here to update the version of the player to use when needed.