我正在传递硬编码值rtmp url&在Flash播放器的VideoDisplay组件中实时流式传输的流名称。它工作得很好,我可以在HTML页面上显示视频流。
<s:VideoDisplay width="100%" height="100%" autoPlay="true" >
<s:source>
<s:DynamicStreamingVideoSource host="rtmp://X.X.X.X/live" streamType="live" >
<s:DynamicStreamingVideoItem streamName="rtmpStream"/>
</s:DynamicStreamingVideoSource>
</s:source>
</s:VideoDisplay>
但是当我从HTML页面传递参数时,它将无法正常工作。它也没有任何错误,但无法在HTML页面上查看实时视频流。
[Bindable]
public var rtmpUrl:String;
[Bindable]
public var rtmpstreamName:String;
/* Assign values to new properties. */
private function initVars():void {
rtmpUrl = FlexGlobals.topLevelApplication.parameters.rtmpUrl;
rtmpstreamName = FlexGlobals.topLevelApplication.parameters.rtmpstreamName;
Security.allowDomain("X.X.X.X");
}
rtmpUrl在rtmpstreamName中传递实时流媒体源和实时流名称,该名称传入视频显示组件。
<s:VideoDisplay width="100%" height="100%" autoPlay="true" >
<s:source>
<s:DynamicStreamingVideoSource host="{rtmpUrl}" streamType="live" >
<s:DynamicStreamingVideoItem streamName="{rtmpstreamName}"/>
</s:DynamicStreamingVideoSource>
</s:source>
</s:VideoDisplay>
HTML嵌入代码:
var flashvars = {};
flashvars.rtmpstreamName = "streamName";
flashvars.rtmpUrl = "rtmp://X.X.X.X/live";
swfobject.embedSWF(
"deepdemo.swf", "flashContent",
"320", "240",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
答案 0 :(得分:0)
我认为您已经忘记了 loaderInfo 参数(请参阅Application's documentation),因此initVars()函数变为:
https://<app-id>.chromiumapp.org/http://qqibrow.github.io
如果您无法访问 loaderInfo ,请在 applicationComplete 上加载此功能。