[SPLIT]Easy Embed MP3

Get help developing custom BBCodes or request one.
Post Reply
User avatar
John connor
Registered User
Posts: 2200
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

[SPLIT]Easy Embed MP3

Post by John connor » Mon Aug 19, 2019 1:23 am

You can do one of two things. Install the Media Embed extension to parse links from Soundcloud or Clyp, or use this BBcode. But it requires an external link like from Amazon S3 or a FTP.



BBcode Usage:

Code: Select all

[audioauto]{URL}[/audioauto]
HTML Replacement:

Code: Select all

<audio autoplay>
      <source src="{URL}">
</audio>
Helpline:

Code: Select all

Autoplay
Last edited by thecoalman on Wed Aug 21, 2019 7:52 pm, edited 1 time in total.
Reason: Split from https://www.phpbb.com/community/viewtopic.php?f=438&t=572196

User avatar
Lumpy Burgertushie
Registered User
Posts: 66561
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Easy Embed MP3

Post by Lumpy Burgertushie » Mon Aug 19, 2019 3:49 am

just for clarity, with the media embed extension all you have to do is post the link to a mp3 file and click on it and it will play.



robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 3277
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Easy Embed MP3

Post by thecoalman » Wed Aug 21, 2019 7:35 pm

The media embed plugin only works with specific sites. Clicking a text link that opens a media player in next page is function of the browser. This requires the file is served with correct mimetype, .mp3 files uploaded to a phpBB forum are not served with audio/mpeg mimetype so it will just give you option to save/open the file with another application.

Using the BBcode above may or may not work depending on the browser and how the server is serving the file, autoplay is also now being blocked by default with a lot of browsers and if it isn't now it will be in the future. This should work every time IF the file is an .mp3(.mp3 extension not required) and being served with mimetype audio/mpeg.

HTML Replacement

Code: Select all

				<audio controls>
					<source src="{URL}" type="audio/mpeg">
				</audio> 
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison

User avatar
John connor
Registered User
Posts: 2200
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: [SPLIT]Easy Embed MP3

Post by John connor » Thu Aug 22, 2019 3:23 am

My bad, I shared the wrong damn BBcode. This is the one you'd want for a player of one track.


BBcode usage:

Code: Select all

[audioplayer={URL}]{COLOR}[/audioplayer]

HTML replacement:

Code: Select all

<audio style="background-color:{COLOR};" src="{URL}" controls></audio>
Helpline:

Code: Select all

Audioplayer
Usage looks like this: [audioplayer=your_link.mp3]#ffffff[/audioplayer]

Can use any hex color.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66561
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [SPLIT]Easy Embed MP3

Post by Lumpy Burgertushie » Thu Aug 22, 2019 7:04 am

please test this.
when I click on it, it opens a player and plays automatically.

https://cyberosis.net/GaryMoore.mp3
I do not have a player installed anywhere that it is using. it could be that the browser has a player built in these days, I don't know.
I am using firefox 66

my thought is that like I said above, the media embed extension that is running here on phpbb.com is playing it with no need for any other type of bbcode etc.

robert
thanks,
robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
paulyii
Registered User
Posts: 171
Joined: Tue Jul 29, 2008 5:19 am
Contact:

Re: [SPLIT]Easy Embed MP3

Post by paulyii » Thu Aug 22, 2019 7:11 am

Lumpy Burgertushie wrote:
Thu Aug 22, 2019 7:04 am
please test this.
when I click on it, it opens a player and plays automatically.

https://cyberosis.net/GaryMoore.mp3
Yup ... it is playing the mp3.
*Thumb Up*

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 3277
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: [SPLIT]Easy Embed MP3

Post by thecoalman » Thu Aug 22, 2019 10:23 am

Lumpy Burgertushie wrote:
Thu Aug 22, 2019 7:04 am
please test this.
when I click on it, it opens a player and plays automatically.

https://cyberosis.net/GaryMoore.mp3
I do not have a player installed anywhere that it is using. it could be that the browser has a player built in these days, I don't know.
I am using firefox 66

my thought is that like I said above, the media embed extension that is running here on phpbb.com is playing it with no need for any other type of bbcode etc.
Look in the address bar after you click the link, it's https://cyberosis.net/GaryMoore.mp3. Copy the link location, close the browser, open the browser and paste in address bar. Same result. That player is function of the browser necessarily added for support of the HTML5 audio and video tags. They all support .mp3, other extensions are hit and miss.

For this to work requires the server send the right mimetype, .mp3 files uploaded to a phpBB forum are served with "application/octet-stream" and will not open the player and may not work in player embedded on a page either.

functions_download.php

Code: Select all

	// Correct the mime type - we force application/octetstream for all files, except images
	// Please do not change this, it is a security precaution
	if ($category != ATTACHMENT_CATEGORY_IMAGE || strpos($attachment['mimetype'], 'image') !== 0)
	{
		$attachment['mimetype'] = (strpos(strtolower($user->browser), 'msie') !== false || strpos(strtolower($user->browser), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream';
	}
As far as the media embed plugin goes it only works with specific sites that can be enabled or disabled in the options. It embeds the player or whatever content there is right on the page. It's not in use here at all on phpBB.com AFAIK. With the media embed plugin this link would be a player instead.

https://www.youtube.com/watch?v=SouCSF45K48
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison

User avatar
John connor
Registered User
Posts: 2200
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: [SPLIT]Easy Embed MP3

Post by John connor » Fri Aug 23, 2019 7:02 pm

Go to my website and look at my signature as an example of the player I gave code to here on this page. Here, try this topic: https://cyberpcforum.com/viewtopic.php?f=26&t=621

Right underneath the moving APC you'll see the player that is created with the code I have here.
Last edited by John connor on Fri Aug 23, 2019 7:04 pm, edited 1 time in total.

User avatar
John connor
Registered User
Posts: 2200
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: [SPLIT]Easy Embed MP3

Post by John connor » Fri Aug 23, 2019 7:04 pm

Yes, the Media embed extension is only good for websites that work with it and can parse their links. Like Clyp or Soundcloud.

Post Reply

Return to “Custom BBCode Development and Requests”