3

私のプログラムは、ストリーム プレーヤーとして使用される AxShockwaveFlash コンポーネントを使用します。問題は、私のコードがほとんどのストリーム プロバイダー (livestream、ustream、own3d.tv) で動作することですが、Justin.TV のプレーヤーには多少問題があります。

実際の問題に移る前に、私のコードを要約させてください。

Inherited 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 エラー (無効な埋め込みコード) が発生します。そこで、彼らにサポートを求めようとしましたが、有効な回答を得ることができませんでした。

_stream.movi​​e 変数は、実際には次のようなストリーム ソースの有効な 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 サンプル)

justin.tv の 'channel=%slug%&auto_play=true&start_volume=100' の部分を urlencode しようとしましたが、それもうまくいきませんでした。

それで、最初はコントロールのflashVars変数を設定することを考えたいくつかの回避策を試し始めました。

しかし、flashVars 変数を設定しようとするたびに、設定されないという奇妙な問題があります。この問題に関するスクリーンショットのサンプルを見つけました。

代替テキスト

したがって、flashVariables を設定できれば、justin.tv プレーヤーのエラーを回避できる可能性があります。ところで、私も Player.SetVariable(key,value) を使用して変数を設定しようとしましたが、それも機能しませんでした。

ノート:

  • .net 4.0 クライアント プロファイルで実行しています。
  • Flash10l.ocx を使用します。
  • "aximp.exe –source "C:\WINDOWS\system32\Macromed\Flash\Flash10l.ocx" を使用して、AxShockwaveFlashObjects.dll、ShockwaveFlashObjects.dll ラッパーを生成しました。
4

1 に答える 1

2

私は最近、justin.tv の動作に問題がありましたが、最終的には次のように簡単でした。

axShockwaveFlash1.FlashVars = "auto_play=true&channel=adventuretimed&start_volume=25";
axShockwaveFlash1.Movie = "http://www.justin.tv/widgets/live_embed_player.swf";

そしてそれは完全に機能します

于 2012-06-26T01:25:11.917 に答える