Is there a way where members can insert custom background music into their topics.... Heres the challenge.... Automatically for every topic they create?
2 posters
Member Topic Music
Mad Scientist- New Member
- Posts : 18
Reputation : 2
Language : English
- Post n°2
Re: Member Topic Music
Hello @SpyroDragon,
Your demand is very weird but it is possible to do it (even if the solutions can vary and be very demanding for such a minor detail).
For example, one of the ways would be to use youtube of course because people don't just go and upload and host their music on some servers. Also, youtube has like all songs possible and embedding it you would not violate any copyrights. So, since youtube bbcode has no options (as far as I know) to autoplay, hide player etc, you would have to go with normal youtube embed code which looks like this:
If you wish to have those buttons (play/pause), then extend width and height to something like 60/30px:
For this code to work you will have to enable HTML in your posts. This is done via admin panel. Note that if you enable HTML, people could abuse it with using script tags to insert javascript code and possibly play with your forum's look a bit.
After all this, you need to create some javascript that would do your "automatic" work. It is not clear what you mean by automatically add music. It could be that your code randomly chooses a song from the pile and embeds it within post, or you might want something like: make javascript code to modify "New Topic" page and add an additional line below topic title for the youtube link, so that people would just paste the link and then you make a button next to it saying something like "Add music" (upon clicking, it would take the link and embed the whole code above into the post).
This would be one approach, but as you can see it's too much of a hassle for such a minor detail. Also, background music in topics would not sound so cool as you think it would.
Your demand is very weird but it is possible to do it (even if the solutions can vary and be very demanding for such a minor detail).
For example, one of the ways would be to use youtube of course because people don't just go and upload and host their music on some servers. Also, youtube has like all songs possible and embedding it you would not violate any copyrights. So, since youtube bbcode has no options (as far as I know) to autoplay, hide player etc, you would have to go with normal youtube embed code which looks like this:
- Code:
<iframe width="1" height="1" src="//www.youtube.com/embed/OPf0YbXqDm0?autoplay=1" frameborder="0" allowfullscreen></iframe>
If you wish to have those buttons (play/pause), then extend width and height to something like 60/30px:
- Code:
<iframe width="60" height="30" src="//www.youtube.com/embed/OPf0YbXqDm0?autoplay=1" frameborder="0" allowfullscreen></iframe>
For this code to work you will have to enable HTML in your posts. This is done via admin panel. Note that if you enable HTML, people could abuse it with using script tags to insert javascript code and possibly play with your forum's look a bit.
After all this, you need to create some javascript that would do your "automatic" work. It is not clear what you mean by automatically add music. It could be that your code randomly chooses a song from the pile and embeds it within post, or you might want something like: make javascript code to modify "New Topic" page and add an additional line below topic title for the youtube link, so that people would just paste the link and then you make a button next to it saying something like "Add music" (upon clicking, it would take the link and embed the whole code above into the post).
This would be one approach, but as you can see it's too much of a hassle for such a minor detail. Also, background music in topics would not sound so cool as you think it would.