HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[RESOLVED] Is it possible to embed audio?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#91373 (In Topic #18386)
Avatar

Fan in action

Hello Forum,

I'm currently running version 9.0.2 and still learning the ropes with ocportal and I was wondering if it's possible to embed audio files (mp3 mostly) in forum posts via a comcode tag or block. Documentation is very vague 

I know I can attach audio files as attachments in the post and if the QuickTime plugin is installed in the user's browser the file can be played automatically however that's not ideal for me.

I was wondering if maybe the file can be embedded like YouTube videos can be embedded and if so how can that be accomplished.

Also, on a related note. Would it be possible to use an embedded flash player for audio files as an alternative to the QT plugin? If so, can it be embedded in a download category entry as well as a forum post?

Any help is greatly appreciated. :)
Back to the top
 
Posted
Rating:
#91381
Avatar

Community saint

I know it can be done. I think you'll find that 'jwPlayer' is already embedded and picks up on music (MP3) files.

I have an 8.x.x example in my Galleries >> Music Room which you can take a look at to see if it helps resolve your issue!

-HOWEVER-

I've only been successful with the version 8.x.x series, and although I can 'see' the files displayed in a version 9.0.2 installation, I haven't yet worked on it sufficiently to actually make them 'play'.

 :thumbs:


Last edit: by Fletch

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#91385
Avatar

Fan in action

Hi Fletch,

Thank you for your response. How do I test this jwplayer?

When I attach an mp3 file or upload it to a custom filed in a download entry, the QuickTime plugin plays the file.

If is there a comcode tag to make that player appear, what would that be?

I tried to check your example but your website seems to be closed for maintenance or upgrade.
Back to the top
 
Posted
Rating:
#91386
Avatar

Community saint

DoDD said

I tried to check your example but your website seems to be closed for maintenance or upgrade.

Oooooops!

Open now.

 :thumbs:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Item has a rating of 5 (Liked by JeanLiked by Duck)  
Rating:
#91401
Avatar

Community saint

Here are three different ways to embed music into a forum post, without using the attachment method. I hope this answers your question, DoDD.

Code

Listen to the sweet sounds of Sleep Away. Click the button to start. <embed src="http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3" width=25 height=25 controls=console autostart=false repeat=false loop=false></embed>

Code

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="52" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="audio_duration=DURATION&amp;external_url=http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3" /><param name="src" value="http://www.techknowl.com/wp-content/uploads/2010/03/audio_player_standard_gray.swf" /><param name="wmode" value="transparent" /><embed type="application/x-shockwave-flash" width="400" height="52" src="http://www.techknowl.com/wp-content/uploads/2010/03/audio_player_standard_gray.swf" wmode="transparent" flashvars="audio_duration=DURATION&amp;external_url=http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3"></embed></object>

Code

<embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" flashvars="audioUrl=http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3" width="400" height="27" quality="best"></embed>
Of course, you need to add the mp3 to the medial library, and add the absolute path to the file to the code.

Here is a link to an example. I am using 9.0.1



Back to the top
 
Posted
Rating:
#91453
Avatar

Fan in action

psydoc said

Here are three different ways to embed music into a forum post, without using the attachment method. I hope this answers your question, DoDD.

Code

Listen to the sweet sounds of Sleep Away. Click the button to start. <embed src="http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3" width=25 height=25 controls=console autostart=false repeat=false loop=false></embed>

Code

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="52" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="audio_duration=DURATION&amp;external_url=http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3" /><param name="src" value="http://www.techknowl.com/wp-content/uploads/2010/03/audio_player_standard_gray.swf" /><param name="wmode" value="transparent" /><embed type="application/x-shockwave-flash" width="400" height="52" src="http://www.techknowl.com/wp-content/uploads/2010/03/audio_player_standard_gray.swf" wmode="transparent" flashvars="audio_duration=DURATION&amp;external_url=http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3"></embed></object>

Code

<embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" flashvars="audioUrl=http://www.epowerstores.com/uploads/filedump/Sleep Away.mp3" width="400" height="27" quality="best"></embed>
Of course, you need to add the mp3 to the medial library, and add the absolute path to the file to the code.

Here is a link to an example. I am using 9.0.1


Thank you very much! Creating a custom comcode tag using your second example enabled me to embed audio in forum posts. And on the downloads entries I'll just stick with the QT plugin for now.

With that out of the way, I have another question that is related to this, though I'm not sure if I should open a new topic for it.

Here's what I'm trying to do:

I set up the downloads catalogue to allow users to upload audio files (mostly mp3) along with the main download (usually a zip file with multiple files inside)

I named the custom field where they upload the mp3 to "Audio" and I know that the mp3 will be uploaded to "uploads/catalogue/filename.mp3"

My objective now is to have the absolute URL of that uploaded mp3 file to be automatically displayed in a custom field in that download entry once it's saved. That way, users can use the absolute URL to embed the uploaded mp3 file into a forum post.

Does that make sense? Is it doable?
Back to the top
 
Posted
Rating:
#91463
Avatar

So this was an upload field type, set up as a custom field for the Downloads?

I think this would render as a link when viewing the download.

In which case wouldn't it be easier to just right-click and choose to copy the URL that way?


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#91534
Avatar

Fan in action

Chris Graham said

So this was an upload field type, set up as a custom field for the Downloads?

Correct.

Chris Graham said

I think this would render as a link when viewing the download.

Not quite. The audio file is displayed with the QT plugin but no link is given.

I've tried setting up another custom field where the data value is "Selected reference to a catalogue entry  Custom fields for 'downloads' category "

The idea was for the users to be able to go back into editing their download and manually select the audio file that was uploaded to the custom field from a selection from uploads/catalogues/file.mp3

However, another issue that I'm running into is that despite setting up view permission on the "Custom fields for Downloads" category, regular users still get an access denied error and thus are unable to browse for the file and add it to the 2nd custom field in order to display the URL.


Chris Graham said

In which case wouldn't it be easier to just right-click and choose to copy the URL that way?


As an admin, I can browse the category in question and select the mp3 file and it will be displayed on the 2nd custom field as an URL.

Problem is that it doesn't give me an absolute URL and that's what I need in order to embed the file using the code Psydoc gave me.

The URL shows up as "uploads/catalogue/file.mp3" however when I click on it, it gives me a relative path that ends in .php

What to do?  :(
Back to the top
 
Posted
Rating:
#91538
Avatar

I can see now that the upload field type does have special handling for video/audio if the galleries addon is installed.

It'll use the GALLERY_VIDEO_GENERAL template which could be edited to give a visible URL instead of video markup, although that would effect other areas unless you know how to do templating contextually (complex).

However to be quite honest, I would always advise anyone starting up a non-trivial project to at least consider writing up a formal specification and getting a programmer to at least quote parts of it. We always say that all projects have a certain percentage of custom requirements that can't be implemented without custom work, and it's wise to go into a project with eyes open and a workable costed plan. I write this because a lot of stuff discussed above seems convoluted to me – I wrote most of the functionality being discussed and even I'm struggling to follow how it's being considered for use ;). It could take you weeks of working out how to bend features to work in ways that weren't intended, and end up with a bit of a mess, when it could take a programmer only around a day to do it properly. If there's no budget for any of that, make sure you have plenty of time and patience ;). ocPortal is the best at giving non-programmers a toolkit, but there's a reason custom dynamic websites don't get done without decent budgets – this stuff is complex, and people's imagination runs away much easier than out-of-the-box tools can make easy to realise.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Item has a rating of 5 (Liked by Fletch)  
Rating:
#91593
Avatar

Fan in action

Chris Graham said

However to be quite honest, I would always advise anyone starting up a non-trivial project to at least consider writing up a formal specification and getting a programmer to at least quote parts of it. We always say that all projects have a certain percentage of custom requirements that can't be implemented without custom work, and it's wise to go into a project with eyes open and a workable costed plan. I write this because a lot of stuff discussed above seems convoluted to me – I wrote most of the functionality being discussed and even I'm struggling to follow how it's being considered for use ;).

Perhaps some context might help you understand what I'm trying to achieve.

I'm using ocPortal as part of my netlabel. I've set it up as a Collaboration Portal so that musicians can work on music collaborations by uploading, sharing and exchanging audio files, MIDI data, DAW projects, remix kits and etc.

Members can share their files in the Download section or create and keep track of specific projects in the Super-Member Projects area.

What I'm trying to achieve with audio files is mostly for convenience purposes. Let's say for instance that a member has a new song that they would like other members to remix it.

The member would then upload all the necessary files of the remix kit and along with it he can upload the original song as well. In order to avoid having to depend on 3rd party websites (like Soundcloud for instance), the original song would be uploaded to that custom field and then embedded on a forum post so other members can easily listen to the song while browsing the post.

However, they can't embed the audio file on a forum post without an absolute URL to the uploaded file. Hence my predicament.

I completely understand where you're coming from however. Unfortunately I don't have the budget to hire a programmer and quite frankly I like to work on these things on my own and I take great pleasure in learning from the process.

ocPortal is a fabulous tool for its flexibility and versatility and it's the only CMS that actually enabled me to start this project as nothing else out there was suitable for it.

I will mark this thread as resolved as my original question was answered. I will however keep researching ways to achieve what I'm trying to do and I'll post my findings here.

Thank you for all your help. :)
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: