私のプログラムは、ストリームプレーヤーとして使用されるAxShockwaveFlashコンポーネントを使用します。 問題は私のコードがほとんどのストリームプロバイダ(livestream、ustream、own3d.tv)で動作することですが、Justin.TVのプレーヤーはやや問題があります。AxShockwaveFlashのFlashVarsを設定する
実際の問題に移る前に、私のコードを要約しましょう。
FlashControlを継承 - これは私が内蔵されたメニューのFlashPlayerの上書きすることができます:
public class FlashPlayer : AxShockwaveFlashObjects.AxShockwaveFlash // Customized Flash Player.
{
private const int WM_MOUSEMOVE = 0x0200;
private const int WM_MOUSEWHEEL = 0x020A;
private const int WM_LBUTTONDOWN = 0x0201;
private const int WM_LBUTTONUP = 0x0202;
private const int WM_LBUTTONDBLCLK = 0x0203;
private const int WM_RBUTTONDOWN = 0x0204;
private const int WM_RBUTTONUP = 0x0205;
public new event MouseEventHandler DoubleClick;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
public new event MouseEventHandler MouseMove;
public FlashPlayer():base()
{
this.HandleCreated += FlashPlayer_HandleCreated;
}
void FlashPlayer_HandleCreated(object sender, EventArgs e)
{
this.AllowFullScreen = "true";
this.AllowNetworking = "all";
this.AllowScriptAccess = "always";
}
protected override void WndProc(ref Message m) // Override's the WndProc and disables Flash activex's default right-click menu and if exists shows the attached ContextMenuStrip.
{
if (m.Msg == WM_LBUTTONDOWN)
{
if (this.MouseDown != null) this.MouseDown(this, new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, Cursor.Position.X, Cursor.Position.Y, 0));
}
else if (m.Msg == WM_LBUTTONUP)
{
if (this.MouseUp != null) this.MouseUp(this, new MouseEventArgs(System.Windows.Forms.MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
}
else if (m.Msg == WM_MOUSEMOVE)
{
if (this.MouseMove != null) this.MouseMove(this, new MouseEventArgs(System.Windows.Forms.MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
}
else if (m.Msg == WM_RBUTTONDOWN)
{
if (this.ContextMenuStrip != null) this.ContextMenuStrip.Show(Cursor.Position.X, Cursor.Position.Y);
m.Result = IntPtr.Zero;
return;
}
else if (m.Msg == WM_LBUTTONDBLCLK)
{
if (this.DoubleClick != null) this.DoubleClick(this, new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 2, Cursor.Position.X, Cursor.Position.Y, 0));
m.Result = IntPtr.Zero;
return;
}
base.WndProc(ref m);
}
}
Playerウィンドウのコードを:(プレーヤーのFlashPlayerのインスタンスである)
private void Player_Load(object sender, EventArgs e)
{
try
{
this.Text = string.Format("Stream: {0}", this._stream.Name); // set the window title.
this.Player.LoadMovie(0, this._stream.Movie); // load the movie.
if (this._stream.ChatAvailable && Settings.Instance.AutomaticallyOpenChat) this.OpenChatWindow();
}
catch (Exception exc)
{
// log stuff.
}
}
だから、これがために素晴らしい作品livestream.com、ustream.com、own3d.tvしかし、それはjustin.tvのプレーヤーに来るとき私は1337エラー(無効な埋め込みコード)を得ています。だから私はask themをサポートしようとしましたが、有効な答えを得ることができませんでした。
_stream.movie変数は、ストリームソースの有効なURLを実際に保持します。
http://cdn.livestream.com/grid/LSPlayer.swf?channel=%slug%&autoPlay=true(ライブストリームの試料)
又は
http://www.justin.tv/widgets/live_embed_player.swf?channel=%slug%&auto_play=true&start_volume=100(justin.tvサンプル)
「チャネル=%をURLENCODEしようとしたスラグ%& auto_play = true & start_volume = 100 'justin.tvの部分ですが、それは動作しませんでしたo。
私は最初にコントロールのflashVars変数を設定すると思ったいくつかの回避策を試しました。
しかし、flashVars変数を設定しようとすると、決して取得できないという奇妙な問題があります。問題のサンプルスクリーンショットを見つけました。
私はflashVariablesを設定することができたのであれば、私は回避策ができjustin.tvプレーヤーのエラーの可能性があります。 Btw、私もPlayer.SetVariable(キー、値)を使用して設定変数を試してみました - それも動作しませんでした。
注:
- 私は、.NET 4.0クライアントプロファイルで実行していますよ。
- Flash10l.ocxを使用しています。私が最近作って問題があった\ WINDOWS \ System32 \ Macromed \ Flash \にFlash10l.ocx "