MyBB Community Forums

Full Version: How To Add SoundCloud In Editor Dropdown Menu?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to add SoundCloud and other types of media in this dropdown menu option in the editor?

View the screenshot.

[Image: 19d24934102569950cdb690a80e94ccd.png]
Hi,

you'll have to edit the file jscripts/bbcodes_sceditor.js

And follow any tutorial:
https://help.forumotion.com/t155778p30-sceditor-auto-embed-button
https://www.mybb.de/doku/haeufig-gestellte-fragen/wie-kann-ich-einen-eigenen-mycode-erstellen/


Hope it works.
(2019-10-24, 08:18 AM)NoRules Wrote: [ -> ]Hi,

you'll have to edit the file jscripts/bbcodes_sceditor.js

And follow any tutorial:
https://help.forumotion.com/t155778p30-sceditor-auto-embed-button
https://www.mybb.de/doku/haeufig-gestellte-fragen/wie-kann-ich-einen-eigenen-mycode-erstellen/


Hope it works.

I still need the proper code to insert the SoundCloud embed link. 

The first website does show the code, but it's not specific to MyBB.

The second website is in German and I don't understand German.

Thanks for trying, though.
Can you give us an example of soundcloud url to embed and the result you want to be displayed, and I can do an example to explain you the different modifications to do
(2019-10-24, 02:29 PM)Crazycat Wrote: [ -> ]Can you give us an example of soundcloud url to embed and the result you want to be displayed, and I can do an example to explain you the different modifications to do

Honestly, I do not know the proper URL for SoundCloud. I have been searching this for an hour and I cannot seem to find the proper URL code that is needed.

The closest thing that I have found is in this THREAD. However, that thread is 6 years old and I do not know if the code is correct for the present time.
Notice that thread shows code for SINGLE SoundCloud track and MULTIPLE SoundCloud tracks.

It has to be in this format found in the bbcodes_sceditor.js file.

It has to be in:
'media name'
'match'
'url'
'html'


	var mybbCmd = {
		align: ['left', 'center', 'right', 'justify'],
		fsStr: ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'],
		fSize: [9, 12, 15, 17, 23, 31],
		video: {				
			'Dailymotion': {
				'match': /(dailymotion\.com\/video\/|dai\.ly\/)([^\/]+)/,
				'url': '//www.dailymotion.com/embed/video/',
				'html': '<iframe frameborder="0" width="480" height="270" src="{url}" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'
			},
			'Facebook': {
				'match': /facebook\.com\/(?:photo.php\?v=|video\/video.php\?v=|video\/embed\?video_id=|v\/?)(\d+)/,
				'url': 'https://www.facebook.com/video/embed?video_id=',
				'html': '<iframe src="{url}" width="625" height="350" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'
			},
			'Liveleak': {
				'match': /liveleak\.com\/(?:view\?[a-z]=)([^\/]+)/,
				'url': 'http://www.liveleak.com/ll_embed?i=',
				'html': '<iframe width="500" height="300" src="{url}" frameborder="0" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'
			},
@Crazycat

I think Serpius wants to embed a link like this so it auto-loads the soundcloud api

https://soundcloud.com/tobykeithmusic/rum-is-the-reason

<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/279390754&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe>

There is a mod for ckeditor that works well i have not looked at or tried it on sceditor

There is one thing i have noticed with soundcloud is that some urls do build differently

https://soundcloud.com/16bl/not-the-only-one-original-mix?in=mightyj-1/sets/morning-chillout

the embed code for this is

<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/196504795&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe>
@fishntassie @Serpius: the big trouble with Soundcloud is that's it's impossible to generate the embedded code whan having the track url (same with playlist / album).
So, what the user will copy in your forum ? The "wordpress embed" or the track url ? The first is parsable but I dislike having html code sent in a javascript (even if it's just to extract an url), the second is not simply exploitable (ajax query to get the page, find the embed code and parse it ?)

Finding a way to allow users to post soundcloud tracks simply, keep a good security level and have good performances in your forum is problematic.
(2019-10-25, 06:25 AM)Crazycat Wrote: [ -> ]@fishntassie @Serpius: the big trouble with Soundcloud is that's it's impossible to generate the embedded code whan having the track url (same with playlist / album).
So, what the user will copy in your forum ? The "wordpress embed" or the track url ? The first is parsable but I dislike having html code sent in a javascript (even if it's just to extract an url), the second is not simply exploitable (ajax query to get the page, find the embed code and parse it ?)

Finding a way to allow users to post soundcloud tracks simply, keep a good security level and have good performances in your forum is problematic.

Hmm, I did not know that allowing SoundCloud tracks on a stand-alone website could present security issues. 

If that is true, then I will have to consider not permitting SoundCloud on my website.

Does anyone else have security concerns in allowing SoundCloud on their website?
(2019-10-25, 12:46 PM)Serpius Wrote: [ -> ]Hmm, I did not know that allowing SoundCloud tracks on a stand-alone website could present security issues. 

If that is true, then I will have to consider not permitting SoundCloud on my website.
I wasn't thinking about Soundcloud tracks but about putting the embeded code in the dropdown part. I don't think soundcloud presents any security issue, the risk is about what your users can put in your form.

Btw, I'll make some tries to see if it's possible without security potential issues.
(2019-10-25, 04:17 PM)Crazycat Wrote: [ -> ]
(2019-10-25, 12:46 PM)Serpius Wrote: [ -> ]Hmm, I did not know that allowing SoundCloud tracks on a stand-alone website could present security issues. 

If that is true, then I will have to consider not permitting SoundCloud on my website.
I wasn't thinking about Soundcloud tracks but about putting the embeded code in the dropdown part. I don't think soundcloud presents any security issue, the risk is about what your users can put in your form.

Btw, I'll make some tries to see if it's possible without security potential issues.

Ok, great! Keep me posted on what you find out.