首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置FlashVars of AxShockwaveFlash

设置FlashVars of AxShockwaveFlash
EN

Stack Overflow用户
提问于 2011-01-18 15:50:59
回答 1查看 9.4K关注 0票数 3

我的一个程序使用AxShockwaveFlash组件作为流播放器。问题是,我的代码适用于大多数流提供商(livestream、ustream、own3d.tv),但是Justin.tv的播放器有点问题。

在讨论实际问题之前,让我总结一下我的代码;

继承的FlashControl -这允许我覆盖闪存的内置菜单:

代码语言:javascript
复制
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的一个实例)

代码语言:javascript
复制
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.movie变量实际上为流源保存了一个有效的URL,如;

http://cdn.livestream.com/grid/LSPlayer.swf?channel=%slug%&autoPlay=true (livestream样品)

volume=100 (justin.tv样本)

尝试为'channel=%slug%&auto_play=true&start_volume=100‘部分编写justin.tv代码,但这也不起作用。

因此,我开始尝试一些工作,首先我想设置控件的flashVars变量。

但是这里有一个奇怪的问题,每当我试图设置flashVars变量时,它永远不会被设置。我在这个问题上找到了一个截图样本;

因此,如果我能够设置flashVariables可能是,我可以工作-解决justin.tv播放器的错误。顺便说一句,我还尝试使用Player.SetVariable(key,value)设置变量--这也不起作用。

备注:

  • 我正在运行.net 4.0客户端配置文件。
  • 使用Flash10l.ocx。
  • 使用“"C:\WINDOWS\system32\Macromed\Flash\Flash10l.ocx”AxShockwaveFlashObjects.dll -source“生成了aximp.exe,ShockwaveFlashObjects.dll包装器。
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-26 01:25:11

我最近遇到了一个问题,使justin.tv的工作,但最后,它是简单的

代码语言:javascript
复制
axShockwaveFlash1.FlashVars = "auto_play=true&channel=adventuretimed&start_volume=25";
axShockwaveFlash1.Movie = "http://www.justin.tv/widgets/live_embed_player.swf";

而且它工作得很完美

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4726053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档