Developer Forum »
audio support
1 posts

How to to support audio on webnodes sites?

I found IsVideo() and GetVideoPlayer() methods, but what would be the easiest way to include audio in sites. What I have in mind could be along the lines:

 

Basic setup:

- source files mostly 128k mp3

- range support in IIS handler would be cool (for bigger files, if it is not there already)

 

Player:

- basically audio tag is enough,

- targeting native support in Chrome and IE, and if needed flash plugin supported playback on Firefox (of course automatic conversion to support ogg for ff would be even better)

- interesting feature would be the ability to stream somehow from single page (with iframe?), so that you can play continuously ("podcast") sound and change soudfile from ajax loaded content pages.

 

Soundcloud.com integration would be cool alternative, too, but maybe a bit of work to integrate if audio is not the main theme of the site.

 

I also wonder what would be the easiest way to handle audio file language version management and selection on demand. Maybe just language specific filename part - and then substitute the file on the page template with the correct language spesific version if that can be found from file library ?

 

Or would it be feasible just to support audio via video, and try to hide the image part in video player ?


120 posts

Hi,

There is no built-in conversion system or player for audio files. In theory you could use the built in videoplayer and video conversion system on audio files, but I would not recommend it. There would be several practical problems with this. 

I would extend the built in audio file content class called: WAF.Engine.Content.Native.SoundFile
This class is used when you upload audio files to the file library. 

Create your own class that inherit from this in the ontology module. Then make sure the class replaces the built in one. Do a full rebuild and you should be able to add your own methods and events to this new custom class in the code file in the WAF_Custom folder. You could here create methods that render you own custom sound player for instance. 

If you want to add functionality for conversion etc. you could do that by overriding and hooking into the OnBeforeUpdate and OnAfterUpdate methods of the content class. These methods could start a background workflow that takes care of the conversion. Let me know if you want help with writing a workflow. You find some example code here: http://developer.webnodes.com/long-running-tasks

Hope this helps!

 Picture

Attachments
1