我必须实现闪光流媒体,以重新启动我们的视频点播系统,但要么因为我之前没有与闪存相关的系统工作,要么因为我太笨,我不能让系统按照原有的方式工作。闪存媒体服务器流媒体:内容保护
我们需要:支票
- 每个文件&用户访问控制上一个WebService每分钟
- 如果租赁时间跑出中流:取消流
- RTMP流
- 动态带宽检查
- 使用Flowplayer进行视频播放(现有许可证)
我有流媒体和带宽检查工作,我似乎无法得到访问控制工作。我不知道我是如何知道播放哪个文件的,或者我可以如何根据客户端发送的密钥播放文件。
服务器端代码(main.asc的):
application.onAppStart = function()
{
trace("Starting application");
this.payload = new Array();
for (var i=0; i < 1200; i++) {
this.payload[i] = Math.random(); //16K approx
}
}
application.onConnect = function(p_client, p_autoSenseBW)
{
p_client.writeAccess = "";
trace("client at : " + p_client.uri);
trace("client from : " + p_client.referrer);
trace("client page: " + p_client.pageUrl);
// try to get something from the query string: works
var i = 0;
for (i = 0; i < p_client.uri.length; ++i)
{
if (p_client.uri[i] == '?')
{
++i;
break;
}
}
var loadVars = new LoadVars();
loadVars.decode(p_client.uri.substr(i));
trace(loadVars.toString());
trace(loadVars['foo']);
// And accept the connection
this.acceptConnection(p_client);
trace("accepted!");
//this.rejectConnection(p_client);
// A connection from Flash 8 & 9 FLV Playback component based client
// requires the following code.
if (p_autoSenseBW)
{
p_client.checkBandwidth();
}
else
{
p_client.call("onBWDone");
}
trace("Done connecting");
}
application.onDisconnect = function(client)
{
trace("client disconnecting!");
}
Client.prototype.getStreamLength = function(p_streamName) {
trace("getStreamLength:" + p_streamName);
return Stream.length(p_streamName);
}
Client.prototype.checkBandwidth = function() {
application.calculateClientBw(this);
}
application.calculateClientBw = function(p_client)
{
/* lots of lines copied from an adobe sample, appear to work */
}
客户端代码:
<head>
<script type="text/javascript" src="flowplayer-3.1.4.min.js"></script>
</head>
<body>
<a
class="rtmp"
href="rtmp://xx.xx.xx.xx/vod_project/test_flv.flv"
style="display: block; width: 520px; height: 330px"
id="player">
</a>
<script>
$f(
"player",
"flowplayer-3.1.5.swf",
{
clip: {
provider: 'rtmp',
autoPlay: false,
url: 'test_flv'
},
plugins: {
rtmp: {
url: 'flowplayer.rtmp-3.1.3.swf',
netConnectionUrl: 'rtmp://xx.xx.xx.xx/vod_project?foo=bar'
}
}
}
);
</script>
</body>
我最初的想法是让从查询字符串的关键,要求网络服务关于哪个文件和用户的密钥是用于播放文件,但我似乎无法找到如何从服务器端播放文件。
我的第二个想法是让流水游戏播放文件,传递键作为查询字符串,如果文件名和键不匹配,然后拒绝连接,但我似乎无法找出它正在播放哪个文件。
我剩下的唯一想法是:创建一个允许用户打开并设置allowReadAccess的所有文件的列表,但是它被调用来允许这些文件,但由于当前的基础设施,这将是笨拙的。
任何提示?
谢谢。