0

I'm trying to modify an SWF using a flash decompiler. I found a SWF that plays a live crypted stream rtmps and I want to use it to embed on my website. I want to be able to change the url for the stream with javascript:

//FUNCTION IN FLASH

public var serverName:String;

function frame1() : *
  {
     this.nc = null;
     this.serverName = "rtmps://and_the_stream_url";
     this.streamName = "A name";
     this.stageListener = new Object();
     this.videoSizeTimer = Number(0);
     this.videoLastW = Number(0);
     this.videoLastH = Number(0);
     this.fullscreenCapable = false;
     this.hardwareScaleCapable = false;
     this.debugInterval = Number(0);
     this.bufferTime = Number(3);
     this.mainInit();
  }

So I basicly want to be able to set the serverName variable with something that I pass with javascript when embedding it on my website.

The javascript i´v been looking at is SWFObject.. for example:

var flashvars={};
flashvars.serverName = "my url..";

swfobject.embedSWF("myContent.swf", "my-target-element", "300", "120", "10.0.0", flashvars);

How do I modify the code in flash (swf file) so that it reads the value I´m passing from javascript?

(IF there are other better ways to include a live stream rtmps stream on a website then also let me know :) I have tried using the flowplayer but I only manage to play rtmp-streams with it)

4

1 回答 1

0

flashvar 存储在 stage.loaderInfo.parameters 中。因此,如果您想遍历所有 flashvars,它将是这样的:

var flashVars:Object = stage.loaderInfo.parameters;

for (var key:String in flashVars) 
{
    var value:String = flashVars[key] as String;
    trace(key + ' = ' + value);
}
于 2018-12-10T13:30:38.293 回答