News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Automatic Flash Player for Media Attachments?

Started by dobomode, February 22, 2007, 10:39:48 AM

Previous topic - Next topic

dobomode

Hello there!

Is there an easy way to do the following:

Whenever a user attaches a media file (mp3 / video), instead of simply providing a link to the attached file (as SMF does currently) to show a little Flash-based player that the user can interact with to play the file?

I tried searching for mods that do this, but no luck. This would be a nice added feature for future versions ;).

Thanks!

Dobo

dobomode

#1
This is how I did it. First, I installed Flash MP3 Player.

Then, I modified Sub.php as follows:

After:

	
	
	
disallow_childrensimilar tobut very different from,
	
	
	
  
require_children, if it is set the listed tags will not be
	
	
	
  
parsed inside the tag.
	
	
*/

	
	
$codes = array(


Insert:


	
	
	
array(
	
	
	
	
'tag' => 'mp3',
	
	
	
	
'type' => 'unparsed_commas_content',
	
	
	
	
'test' => '\d+,\d+\]',
	
	
	
	
'content' => '$1',
	
	
	
	
'block_level' => true,
	
	
	
	
'validate' => create_function('&$tag, &$data, $disabled''$id = uniqid(rand()); $data[0] = \'<p id="\'.$id.\'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this media.</p><script type="text/javascript">var FO = {movie:"/flash_mp3_player/mp3player.swf",width:"\'.$data[1].\'",height:"\'.$data[2].\'",majorversion:"7",build:"0",bgcolor:"#FFFFFF",flashvars:"\'.(un_htmlspecialchars($data[0])).\'"};UFO.create(FO,"\'.$id.\'");</script>\';')
	
	
	
),


Then, I can use this in my posts to embed mp3's using flash:

[mp3=300,20]file=filename.mp3&shownavigation=true&showdigits=true[/mp3]

In order for this to happen, Flash MP3 Player must be installed in the root HTML directory, i.e. /flash_mp3_player.

Finally, you also need to add this to your HTML HEAD section:

<script language="JavaScript" src="http://www.yoursite.com/flash_mp3_player/ufo.js" type="text/javascript"></script>

Here is an example of this in action on my page:

http://www.ghostborn.com/index.php/menu,12/sa,view/topic,29

Cheers!

Dobo

John S

Quote from: dobomode on February 22, 2007, 10:39:48 AM
Whenever a user attaches a media file (mp3 / video), instead of simply providing a link to the attached file (as SMF does currently) to show a little Flash-based player that the user can interact with to play the file?

this is an awesome feature! i need it!!! it would be awesome to have it automatically convert the video files to a flash version embedded into the post.

one of the boards in my forum is 'videos'; where people can post videos and others can view and comment on..  (similar to YouTube)

but currently everyone is posting their videos from their harddrive as an attachment (nothing wrong with that..) BUT when another member wants to view the video they first have to download it > watch it > then go back to the forum and comment...

how can i allow for the attachment of video files be automatically converted into a flash video file (such as that in YouTube) and the members can just click on play and watch the video embedded into the post.?

karlbenson

youtube arent flash files,

flash player which loads movie/clip files.

John S

ok, thats even better... can we code something that will play movie/clip attachments automatically in the post using a flash player?

John S

is this possible? anyone willing to give it a go? -- members are upoading videos as an attachment but then each person needs to download it before viewing.. can these videos be automatically embeded into the post and played using a flash player?

Bigguy

Does the streaming mod not work for you:

http://custom.simplemachines.org/mods/index.php?mod=121

Or is it not what you want. ??? It works great on my site. :)

John S

i think ive tried that b4 - correct me if im wrong.. do they only have the option of choosing a file elsewhere on the net?

or can they upload an attachment and will it, if its a media file, be used on the streaming mod in the post itself? or can this mod be modified to do as explained above?

Bigguy

It doesn't by default use any uploaded files but I guess it could be modified to use attachments.

John S

please please please.. this would be an awesome modification!

please, let me know if you can do it.

Bigguy

You would really have to ask the author of the mod if they can make the changes. Maybe they can do it right away or maybe they have already thought of it and are putting it into a new version.

aj113

Well, sorry I'm nine years late to the partybut I still can't see a solution for this. Is there one?

nend

#12
It may be better to create a new topic, however I doubt that would do any good as Flash is dead. Google and others have already removed browser support for it, so it's fruitless to even try to get it to work.

aj113

OK so perhaps I'm using the wrong terminology. Whether it involves flash or not, I want to play uploded mp3 attachments within the post they are attached to. Is that possible?

Sir Osis of Liver

#14
You would have to create a custom bbc for html5 audio player.  Assuming you are admin, if you put this in a post, it will display a simple player -



[html]<audio controls>
<source src="http://www.domain.com/music/Woof.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>[/html]



Don't know how difficult it would be to create a bbc to do this, but should be possible.  Will tinker with it when I have time.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

#15
Ok, mope, now pay attention.

First, install this mod - http://custom.simplemachines.org/mods/index.php?mod=3864

Then configure it like this -

   BBCode Name - player (or whatever)

   Description - Audio Player (or whatever)

   Type - [tag]content[/tag]

   BBC HTML - <audio controls>
                     <source src= "{content}" type="audio/mpeg">
                     Your browser does not support the audio element.
                     </audio>

All other settings use default for starters.  Configure permissions, upload an image for the button, otherwise it will be blank grey square.  Users must enter full url between the [player] tags, like this -

  [player]http://www.domain.com/music/Woof.mp3[/player]

It werks gud!

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shawnb61

The Simple Audio Video Embedder mod does exactly that:
http://custom.simplemachines.org/mods/?mod=2681

For all sorts of file types.   

Except .mp3s....
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

aj113

Thank you both for contributing, however, both of these solutions play files that are already uploaded elsewhere. I want to attach or at least upload an mp3 to some place on the server and then play it.

vbgamer45

Quote from: aj113 on December 06, 2016, 04:32:20 AM
Thank you both for contributing, however, both of these solutions play files that are already uploaded elsewhere. I want to attach or at least upload an mp3 to some place on the server and then play it.
I don't know of anything like that but would be an interesting mod idea
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Sir Osis of Liver

You can't play an attached mp3 file because attachment filenames are hashed and file extension is removed.  The player would not recognize it as mp3 file.  If you tried to combine an uploader with an audio player, you would have to allow uploading mp3 files retaining original filename, and that would create the security risk that attachment hash is designed to prevent.  May be a way to work around it, but can't think of it offhand.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

nend

It may be possible to convert the files server side, will require a dedicated box as I am sure no shared host is going to allow you to do this, plus they wouldn't have the proper libs installed.

This is something more popular streaming services do, it's not going to be cheap doing so, server cost, etc.

You may also be able to achieve something using your own personal computer from home, connecting to your server, downloading, converting and then uploading the files. This is still all in the custom space and if you can't do it yourself, like mentioned above, it's going to cost you.

aj113


nend

My bad, MP3 is supported by HTML5 video and audio. I even have some embedded on my website. For some reason I was thinking of some other format.

dougiefresh

Quote from: aj113 on December 07, 2016, 02:09:32 PM
Dougiefresh seems to have achieved it without too many issues:

http://www.simplemachines.org/community/index.php?topic=550341.0
I was thinking about adding a video component to that mod.....  I've got video MIME detection support already built for it, mostly in order to address the differences between OGG and OGV files (works off of file extension).  Was also thinking about adding a few of other features/fixes to the mod, mostly to address a particular bug report about guests not being able to play attachments if they can't see them....

Are you interested in an audio and/or video tag utilizing this HTML5 audio and video tags?  Cause I can build one into the mod as well....

aj113

For me, the mod does exactly what I wanted. Obviously if there are bugs it would be great for them to be fixed, but I don't need any more functionality than it has already.

Advertisement: