0

これが可能かどうか疑問に思っています。可能であれば、いくつかのコード例もあります。ライブアドレス中にプレゼンターが不在のときにボタンを押すことができるようにしようとしています。このボタンは、クライアント側でjpgまたはある種の画像をトリガーして、彼が現在不在であることを示し、プレゼンターのマイクをミュートしますか?FMIS 4とAS3でこれがどのように可能になるかについて誰かが何か考えを持っていますか?

4

1 に答える 1

0

はい、これは実行可能です。書くべきコードが少しあります。内訳は次のとおりです。

  • プレゼンターのクライアントはNetConnectionを作成してから、NetStreamをFMSに公開します。
  • プレゼンターがボタンを押したとき:
    1. プレゼンターのクライアントがマイクゲインを0に設定
    2. Presenterのクライアントは、NetStream.send()を使用して、サブスクライブしているすべてのクライアントにメッセージを送信します。メッセージは基本的に、すべてのサブスクライブしているクライアントが実行する必要がある関数といくつかの引数の名前です。この場合、関数は「離れた」画像を表示/非表示にします。
  • 次に、プレゼンターが戻ったときに逆の操作を行います

[編集] 使用方法を明確にするためにいくつかのコードを追加しますNetStream.send()

プレゼンターコード:

private function onAwayButtonClick(event:Event):void
{
    stream.send("toggleAwayImageDisplay"); // stream is a NetStream you created elsewhere
    mic.gain = 0; // mic is the Microphone you attached to the stream
}

加入者コード

NetStreamを作成するときは、クライアントプロパティを使用して、上記で指定した関数「toggleAwayImageDisplay」の場所がわかるようにします。

private function someMethodThatCreatesNetStream(netConnection:NetConnection):void
{
    stream = new NetStream(netConnection);
    // you could use any object here, as long as it has the method(s) you are calling
    stream.client = this;

    // this might be nicer, you can reference functions from any class this way
    // the key in this client object is a function name
    // the value is a reference to the function
    // var client:Object =
    //     { toggleAwayImageDisplay: toggleAwayImageDisplay,
    //       doSomethingElse: anotherObject.doSomethingElse }; 
    // stream.client = client;
    // be careful about memory leaks though :)
}

private function toggleAwayImageDisplay():void
{
   // now show or hide the image
}
于 2012-05-22T20:50:16.190 に答える