Friday, 13 September 2013

Changing the data of a object and the value of a parameter inside the embed from twitch

Changing the data of a object and the value of a parameter inside the
embed from twitch

Hello I am trying to change the data of a object and the value of a
parameter inside the embedding code from twitch.
I am not that good on javascript and could use some help.
I have done my research with no luck.
all help is appreciated :)


the embedding code that i want to change (this is a fresh embedding code,
no edits)
<object type="application/x-shockwave-flash" height="378" width="620"
id="live_embed_player_flash"
data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=thelifeisyours"
bgcolor="#000000">
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="allowNetworking" value="all" />
<param name="movie"
value="http://www.twitch.tv/widgets/live_embed_player.swf" />
<param name="flashvars"
value="hostname=www.twitch.tv&channel=thelifeisyours&auto_play=true&start_volume=25"
/>
</object>

here is the js i got so far and it doesn't work :P (remember i am a noob
in js)
function changestream1(){
var streamIn = document.getElementById('stream1').value;
var object = document.getElementById('live_embed_player_flash');
var param = document.getElementById('param');
object.setAttribute("data",
"http://www.twitch.tv/widgets/live_embed_player.swf?channel=" +
streamIn);
param.setAttribute("value", "hostname=www.twitch.tv&channel=" +
streamIn "&auto_play=true&start_volume=25" + streamIn);
}
the idea is that the js will create the data in the object and the value
in the parameter.


if you need a visual of how i am thinking this out press Link :D
JsFiddle

link to the website where this is going to be used
twitchgrabber

No comments:

Post a Comment