News:

Wondering if this will always be free?  See why free is better.

Main Menu

Request info on embedding scm player code

Started by BuddahBoy, April 01, 2014, 04:31:21 PM

Previous topic - Next topic

BuddahBoy

Greetings - hope this is the correct thread, if not please accept my apologies. 

I am new to SCM - so far the documentation has been excellent and the forums very useful, but I have encountered a problem that I require some assistance and/or advice on. 

Want to place code from the SCM player which needs to be after the <body> tag - trying to insert it in index.template.php in default template. 

Instructions are to place code under <body> tag - but I'm not sure how to do that - think the code should go here: </head>
<body>';
}

function template_body_above()
{


but don't know how to include it.  SCM Code:  <!-- SCM Music Player http://scmplayer.net -->
<script type="text/javascript" src="http://scmplayer.net/script.js"
data-config="{'skin':'skins/black/skin.css','volume':50,'autoplay':false,'shuffle':false,'repeat':1,'placement':'bottom','showplaylist':false,'playlist':[{'title':'Jai Ambe by Turkantam - visit www.VishwaGifts.com','url':'http://www.xxxxxxx.com/media/jai-ambe-by-turkantam.mp3'}]}" ></script>
<!-- SCM Music Player script end -->


Using a fresh install of 2.0.7 and the default theme that was installed (default under Themes?) - would greatly appreciate any advice. 


Thanks much
Ron

BuddahBoy

After reading about this in a post here on the forum, it appears that scm and iframes don't play well together and the player includes an iframe so I'm abandoning the idea - will look at Wimpy instead maybe. 

Thanks much
Ron

margarett

Actually no, you *CAN* use iframes for players. All the video embedders with them ;)
What you can't is to run SMF *inside* an iframe.

Now, why can't you get that to work?
You can probably add it after:
// Custom banners and shoutboxes should be placed here, before the linktree.
If you put it inside an "echo" and be careful to escape all single quotes, it should work. Maybe :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

Well I thank you very much indeed!

Allow me to exhibit my ignorance by saying that since I don't know php, this is where I went and did: 

went to:

// Custom banners and shoutboxes should be placed here, before the linktree.



// Show the navigation tree.
theme_linktree();
}


and entered the player code, ending up with:

// Custom banners and shoutboxes should be placed here, before the linktree.

<!-- SCM Music Player http://scmplayer.net -->
<script type="text/javascript" src="http://scmplayer.net/script.js"
data-config="{'skin':'skins/black/skin.css','volume':50,'autoplay':false,'shuffle':false,'repeat':1,'placement':'bottom','showplaylist':false,'playlist':[{'title':'Jai Ambe by Turkantam - visit www.VishwaGifts.com','url':'http://www.xxxxxxx/media/jai-ambe-by-turkantam.mp3'}]}" ></script>
<!-- SCM Music Player script end -->

// Show the navigation tree.
theme_linktree();
}


which created the error: syntax error, unexpected '<'

this was done on the default template, index.template.php

I very much appreciate your assistance - can you give me any further advice that would help me get this working?  You just might make it seem that I clean up pretty good! 

Thanks again for your time and effort
Ron

margarett

You need to add, before that:
echo '

And at the end you need to close the instruction with
';

In the code you already have, you need to escape all single quotes
'
With a backslash, thus becoming (except the ones you just added)
\'

If you edit the file with, eg, Notepad++, the color of the text should help you understand how is it going. Specifically, everything inside the echo should be gray.

I can't give you how to do it as I'm on the phone. But it's actually easy, you'll see ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

Apologies again for disturbing and I understand you are busy, but maybe if you have moment at some time you can correct me.  Thought I followed your input but evidently not

// Custom banners and shoutboxes should be placed here, before the linktree.

echo '
<script type="text/javascript" src="http://scmplayer.net/script.js"
data-config="{\'skin\':\'skins/black/skin.css\',\'volume\':50,\'autoplay\':false,\'shuffle\':false,\'repeat\':1,\'placement\':\'bottom\',\'showplaylist\':false,\'playlist\':[{\'title\':\'Jai Ambe by Turkantam - visit www.VishwaGifts.com\','url\':\'http://www.xxxxxxx/media/jai-ambe-by-turkantam.mp3\'}]}" ></script>';


// Show the navigation tree.


error I got on page:  syntax error, unexpected 'url' (T_STRING), expecting ',' or ';'

Thank you once more - much appreciated
Ron


margarett

Not really busy, just in bed already :P

I'll have a look tomorrow for you. Can we know the full path to the mp3 you masked in the script? So that I can test it?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

Most certainly -

http://www.truthsimplicitylove.com/media/jai-ambe-by-turkantam.mp3

don't know why the link doesn't come out right - I used the URL insert feature - but you get the idea I'm sure. 

Thank you very much for your willingness to assist me with this.

All the best
Ron

margarett

There 'ya go:

echo '
<!-- SCM Music Player http://scmplayer.net -->
<script type="text/javascript" src="http://scmplayer.net/script.js"
data-config="{\'skin\':\'skins/black/skin.css\',\'volume\':50,\'autoplay\':false,\'shuffle\':false,\'repeat\':1,\'placement\':\'bottom\',\'showplaylist\':false,\'playlist\':[{\'title\':\'Jai Ambe by Turkantam - visit www.VishwaGifts.com\',\'url\':\'http://www.truthsimplicitylove.com/media/jai-ambe-by-turkantam.mp3\'}]}" ></script>
<!-- SCM Music Player script end -->';

;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

First of all, thank you so very much for taking the time to help me out with this - player works primo, thank you.  I do have, if you don't mind another question. 

I want to add more songs and will do it manually, so the question is could you show me please where to begin and end the cut & past process in order to add different titles and URLs to them?  I tried to on my own but didn't work it out.  By using the good code you provided me with could you show me how to add another item by adding the song currently in the list a second time so I can use that code as a guideline to add more songs - I'd like to add about 20 more songs and will need to do it manually.  Hope this makes sense.

2nd, wanted PM something not support related, is that okay with you? 

Thank you very very much

margarett

You can't add multiple instances of the player. What I *think* (because I've never seen that code before :P ) is to add the titles in the playlist.
Can you point me some other links and names of songs you have so that I can try to stuff them in? It has to be really on a trial-and-error, really :P

As for 2: of course ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

Didn't want multiple instances of the player - just want to add to the playlist which is standard in the player when getting the code from scmplayer.net - I just can't figure out the code to add different songs to the list.  I've added 2 other mp3s at the same URL above, www.truthsimplicitylove.com/media/haidakhandi-stay-nam-turkantam.mp3 and the second title, same path is - namai-shankar-turkantam.mp3

As an example, here is code for 3 songs which I am able to add on more songs manually (for the example just using same title) - this is only to show my desired end result: 

<!-- SCM Music Player http://scmplayer.net -->
<script type="text/javascript" src="http://scmplayer.net/script.js"
data-config="{'skin':'skins/simpleBlue/skin.css','volume':50,'autoplay':false,'shuffle':false,'repeat':0,'placement':'bottom','showplaylist':false,'playlist':[{'title':'Jai Ambe by Turkantam - visit www.VishwaGifts.com','url':'http://www.truthsimplicitylove.com/media/jai-ambe-by-turkantam.mp3'},{'title':'Jai Ambe by Turkantam - visit www.VishwaGifts.com','url':'http://www.truthsimplicitylove.com/media/jai-ambe-by-turkantam.mp3'},{'title':'Jai Ambe by Turkantam - visit www.VishwaGifts.com','url':'http://www.truthsimplicitylove.com/media/jai-ambe-by-turkantam.mp3'}]}" ></script>
<!-- SCM Music Player script end -->


using the code you provided I can only copy and paste the song info, add it and change the title and URL - hope I am explaining this correctly. 

thank you once more
Ron

margarett

Ah, so I was forgetting this :P

So, it is more or less easy, if you respect the structure. Look at this:
echo '
<!-- SCM Music Player http://scmplayer.net -->
<script type="text/javascript" src="http://scmplayer.net/script.js"
data-config="{
\'skin\':\'skins/black/skin.css\',
\'volume\':50,
\'autoplay\':true,
\'shuffle\':false,
\'repeat\':0,
\'placement\':\'bottom\',
\'showplaylist\':false,
\'playlist\':[
{\'title\':\'Jai Ambe by Turkantam\',\'url\':\'http://www.truthsimplicitylove.com/media/jai-ambe-by-turkantam.mp3\'},
{\'title\':\'Haidakhandi Stay Nam Turkantam\',\'url\':\'http://www.truthsimplicitylove.com/media/haidakhandi-stay-nam-turkantam.mp3\'},
{\'title\':\'Namai Shankar Turkantam\',\'url\':\'http://www.truthsimplicitylove.com/media/namai-shankar-turkantam.mp3\'}
]
}" ></script>
<!-- SCM Music Player script end -->';

It's better to see it like this, innit? ;)

So, your playlist can easily be filled if you respect the structure ahead:
{'title':'Haidakhandi Stay Nam Turkantam','url':'http://www.truthsimplicitylove.com/media/haidakhandi-stay-nam-turkantam.mp3'},
So:
opening braket --> {
title: title_of_your_song, url:'http://www.address.com/mp3
Closing bracket --> }
comma --> , (except in last line, no comma in last line)

The problem is... All of those have to be between quotation marks --> '
Too bad, in PHP those are delimiters. So, for them to be recognized as "textual quotation marks", they have to be escaped with a backslash --> \

And that results in the code above ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

Greets - sorry for the delay in responding, been around out and about.  So I got this working after you gave me the initial code - played with it for a while but finally added another 14 or so songs once I got the code right so thank you very much - will also PM you, on a different matter, not support related. 

Thanks
Ron

ivanTW

Interesting post....

Do either of you know if I can use this code to post it in a post? I just want to place the player in a message of a topic so that users can come back to that thread and listen if they need to. If so, do you know where I'd put the code?

Thanks.

margarett

Not sure, honestly. As an admin it might work, inside HTML tags. Just paste it and test ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

BuddahBoy

Quote from: ivanTW on April 24, 2014, 04:00:02 PM
Interesting post....

Do either of you know if I can use this code to post it in a post? I just want to place the player in a message of a topic so that users can come back to that thread and listen if they need to. If so, do you know where I'd put the code?

Thanks.

The SCM player is a sitewide player - if you want to put music in a post then try this mod: http://custom.simplemachines.org/mods/index.php?mod=2681  I've used it and really is easy

Advertisement: