Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
auto embed MP3 urls
#11
(09-17-2016, 09:26 PM)alley Wrote: Does not work

Try the Event code again, it should work now.

I had to change it again since it was missing the for() loop. (I had a real trouble posting the code initially with constant anti-flood/bot/spam popping up from cloudflare every edit :/)
Reply
#12
(09-18-2016, 03:50 AM)stryderunknown Wrote:
(09-17-2016, 09:26 PM)alley Wrote: Does not work

Try the Event code again, it should work now.  

I had to change it again since it was missing the for() loop.  (I had a real trouble posting the code initially with constant anti-flood/bot/spam popping up from cloudflare every edit :/)

I did not use the eventhandler code, I used this one: 
PHP Code:
<script>
if (! 
url2media){

// don't edit url2media variable if you have the script exist multiple times in a page
var url2media="1";
var 
links document.getElementsByTagName("a");

for (var 
0links.lengthi++) {
if (
links[i].href.search("mp3") !== -1) {
links[i].outerHTML ='<video id="mediamp3" controls=""><source src="'+links[i]+'" type="audio/mpeg"></video>';
 }
}
</
script
Reply
#13
Okay I can see the error (sorry for the inconvenience). It's part to do with my attempt to stop the code being created too many times and part to do with how javascript handles if !(variable)

So rather than using the original method I was trying to do, it's simpler just to use the eventhandler version as it will only call once, even if there are multiple issues of code inserted and it will be called when the document is loaded, so you could insert it nearly anywhere in a template.

If you check the post with original code, I've edited it to reflect the changes (rather than keep quoting similar code multiple times)
Reply
#14
Hey, thanks so much @stryderunknown  ... it works!  Big Grin stryderunknownstryderunknownstryderunknown
Reply
#15
This user has been denied support. This user has been denied support.
(09-16-2016, 12:14 AM)alley Wrote:
(09-15-2016, 11:49 PM)Starnova Wrote: I use the mod Automedia.. it just requires adding any link and plays. I much prefer jplayer but I cannot get it to work on mybb. 1.86  you can take a look if you wish here:

https://www.ebook-mecca.com/Thread-Love-...e-Chickens

it is not a pretty player at all and I really do not like it but it is practically the only thing that works ,,  I guess mybb does not find a use for players like jplayer, but many users do..

THanks, but what in the hell does "love among the chickens" have to do with myBB?  Dodgy

That is the mp3 file in comedy on my e-book site to show you the working program. Wink

(09-16-2016, 12:14 AM)alley Wrote:
(09-15-2016, 11:49 PM)Starnova Wrote: Its the only thing I could get to work .. I have tried everything else.
May the source be with you!
Reply
#16
@stryderunknown 
This is great, but I noticed that this code seems to put the mp3 player way down at the bottom of the post. Is there a way to have it display the mp3 player at the top of the post?
Reply
#17
@Alley
Sorry for the delay in replying, Placement is done through the use of the CSS entry using a relative position and top/bottom/left/right adjustments.
Reply
#18
That has nothing to do with this MyCode not working.  Rolleyes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)