Jump to content
Macrura

Soundmanager2 Audio for Processwire

Recommended Posts

The first one is the one generated in the template, the second one is generated with the tag '[smplayer tag=cryplant type=cassette]' in the description text field. As if the first one doesn't take the ma-r90-body-skin.png image along from the options.

Share this post


Link to post
Share on other sites

you'd need to do this in your options:

[smplayer tag=cryplant type=cassette cassette=ma-r90]

Share this post


Link to post
Share on other sites

The one in the tag looks good. It's the one coded in the template that doesn't have the right look. I prefer to have it in the template because it will always be just one audio file and it saves me a fraction not to put the tag into the text field all the time.

In the template it says

	$sm2 = $modules->get('TextformatterSoundmanager');
	$options = [
		'type' => 'cassette',
		'cassette' => 'ma-r90',
	];
	$track = $page->audio->first();
	echo $sm2->player($track, $options);

Am I missing something there?

Share this post


Link to post
Share on other sites

ok that's a bug, you can either uncheck the default skin in the module config, or upgrade to the latest version (110), which fixes that.

Also note that the newest version would be injecting the JS var into the header so you wouldn't need to hardcode that; also you shouldn't need any extra css, as the module should just work with this version...

Share this post


Link to post
Share on other sites

Just installed the new version and it works like a charm, drastically fantastically!

One little thing is that on the Soundmanager demo (http://www.schillmania.com/projects/soundmanager2/demo/cassette-tape/) you can see the tape as a thin line moving from the left reel to the right, that isn't there in the module.

I'm really happy with how it looks now. The first original Carl Cryplant thematic mix tapes I did in the 1980s were on real C-90 cassettes.

Share this post


Link to post
Share on other sites

yah, i havn't been able to get the reels to work, it's something about the reel mask and the canvas that isn't translating...  could take some serious js troubleshooting to fix that..

Share this post


Link to post
Share on other sites

that's great to hear – you may be one of the only sites on the internet using the Cassette UI..

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

thanks for this extension. I'm working now on a website with audio samples. I found and installed your module but can't get it work.

I installed and setup everything, following the descriptions step by step. What I also did is:
Created a file field – "audio_file" (0=No limit, Automatic … ). In the soundmodule-setup I applied this "audio_file" to the Audio Files Field.
I created a text-field and under details -> »text formatters« I applied the Soundmanager2 Audio… . In the soundmodule-setup I applied this text-field to the Tag Field.

This is in the template file:

<?php
    $options = [
      'type' => 'bar-ui',
      'skin' => 'gradient-fat',
    ];
  
    foreach($page->audio_file as $track) {
      $content .= $sm2->player($track, $options);
  }
  ?>

The template has the two fields ("audio_file" and the text field).

And on the page I uploaded a file – brahms_01.mp4 in the audio_file field. In the text field I'm trying to echo the mp.4 file with this: [smplayer tag=brahms_01]
 

Tracy doesn't show any errors.

Share this post


Link to post
Share on other sites

@neophron

(1) Are you just wanting to output your own player on a page, or use the Textformatter? The Textformatter is for putting in shortcodes into Textarea fields, like Body.

(2) The code you posted would only work if you are doing delayed output using a $content var, otherwise if your templates are direct output, you have to echo the content, something like:

<?php
    $options = [
      'type' => 'bar-ui',
      'skin' => 'gradient-fat',
    ];
  
    foreach($page->audio_file as $track) {
      echo $sm2->player($track, $options);
  }

(3) if you want to use the text field to output an audio player based on a shortcode, then you have to echo the textfield, with the Textformatter applied, like:

echo $page->myTextField;

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks, (2) is the solution for me 🙂

I'm using the markup regions output strategy.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By adrian
      Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS

       
      Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
    • By adrian
      This module allows you to automatically rename file (including image) uploads according to a configurable format
      This module lets you define as many rules as you need to determine how uploaded files will be named and you can have different rules for different pages, templates, fields, and file extensions, or one rule for all uploads. Renaming works for files uploaded via the admin interface and also via the API, including images added from remote URLs.   Github: https://github.com/adrianbj/CustomUploadNames
      Modules Directory: http://modules.processwire.com/modules/process-custom-upload-names/
      Renaming Rules
      The module config allows you to set an unlimited number of Rename Rules. You can define rules to specific fields, templates, pages, and file extensions. If a rule option is left blank, the rule with be applied to all fields/templates/pages/extensions. Leave Filename Format blank to prevent renaming for a specific field/template/page combo, overriding a more general rule. Rules are processed in order, so put more specific rules before more general ones. You can drag to change the order of rules as needed. The following variables can be used in the filename format: $page, $template, $field, and $file. For some of these (eg. $field->description), if they haven't been filled out and saved prior to uploading the image, renaming won't occur on upload, but will happen on page save (could be an issue if image has already been inserted into RTE/HTML field before page save). Some examples: $page->title mysite-{$template->name}-images $field->label $file->description {$page->name}-{$file->filesize}-kb prefix-[Y-m-d_H-i-s]-suffix (anything inside square brackets is is considered to be a PHP date format for the current date/time) randstring[n] (where n is the number of characters you want in the string) ### (custom number mask, eg. 001 if more than one image with same name on a page. This is an enhanced version of the automatic addition of numbers if required) If 'Rename on Save' is checked files will be renamed again each time a page is saved (admin or front-end via API). WARNING: this setting will break any direct links to the old filename, which is particularly relevant for images inserted into RTE/HTML fields. The Filename Format can be defined using plain text and PW $page variable, for example: mysite-{$page->path} You can preserve the uploaded filename for certain rules. This will allow you to set a general renaming rule for your entire site, but then add a rule for a specific page/template/field that does not rename the uploaded file. Just simply build the rule, but leave the Filename Format field empty. You can specify an optional character limit (to nearest whole word) for the length of the filename - useful if you are using $page->path, $path->name etc and have very long page names - eg. news articles, publication titles etc. NOTE - if you are using ProcessWire's webp features, be sure to use the useSrcExt because if you have jpg and png files on the same page and your rename rules result in the same name, you need to maintain the src extension so they are kept as separate files.
      $config->webpOptions = array(     'useSrcExt' => false, // Use source file extension in webp filename? (file.jpg.webp rather than file.webp) ); Acknowledgments
      The module config settings make use of code from Pete's EmailToPage module and the renaming function is based on this code from Ryan: http://processwire.com/talk/topic/3299-ability-to-define-convention-for-image-and-file-upload-names/?p=32623 (also see this post for his thoughts on file renaming and why it is the lazy way out - worth a read before deciding to use this module). 
       
       
      NOTE:
      This should not be needed on most sites, but I work with lots of sites that host PDFs and photos/vectors that are available for download and I have always renamed the files on upload because clients will often upload files with horrible meaningless filenames like:
      Final ReportV6 web version for John Feb 23.PDF

×
×
  • Create New...