home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
How to play a video?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="kaybe" data-source="post: 37185" data-attributes="member: 12798"><p>Hello, I am writing a plugin and want to show a video in the middle of the screen.</p><p>The problem I have is, that there is no picture, only sound.</p><p>Perhaps someone could help me.</p><p>I put my code in the plugin template, so its easy to read.</p><p>To start the player you have to push buttonOne.</p><p></p><p></p><p>[code]</p><p>using System;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p>using MediaPortal.Player;</p><p>using MediaPortal.Dialogs;</p><p>namespace OurPlugin</p><p>{</p><p></p><p> public class Class1 : GUIWindow, ISetupForm</p><p> {</p><p> [SkinControlAttribute(2)]</p><p> protected GUIButtonControl buttonOne = null;</p><p> [SkinControlAttribute(3)]</p><p> protected GUIButtonControl buttonTwo = null;</p><p> [SkinControlAttribute(99)]</p><p> protected GUIVideoControl contr = null;</p><p></p><p> public Class1()</p><p> {</p><p></p><p> }</p><p></p><p> #region ISetupForm Members</p><p></p><p> // Returns the name of the plugin which is shown in the plugin menu</p><p> public string PluginName()</p><p> {</p><p> return "MyFirstPlugin";</p><p> }</p><p> // Returns the description of the plugin is shown in the plugin menu</p><p> public string Description()</p><p> {</p><p> return "My First plugin tutorial";</p><p> }</p><p></p><p> // Returns the author of the plugin which is shown in the plugin menu</p><p> public string Author()</p><p> {</p><p> return "kaybe";</p><p> }</p><p></p><p> // show the setup dialog</p><p> public void ShowPlugin()</p><p> {</p><p> MessageBox.Show("Nothing to configure, this is just an example");</p><p> }</p><p></p><p> // Indicates whether plugin can be enabled/disabled</p><p> public bool CanEnable()</p><p> {</p><p> return true;</p><p> }</p><p> // get ID of windowplugin belonging to this setup</p><p> public int GetWindowId()</p><p> {</p><p> return 5678;</p><p> }</p><p> // Indicates if plugin is enabled by default;</p><p> public bool DefaultEnabled()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> // indicates if a plugin has its own setup screen</p><p> public bool HasSetup()</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)</p><p> {</p><p> strButtonText = PluginName();</p><p> strButtonImage = String.Empty;</p><p> strButtonImageFocus = String.Empty;</p><p> strPictureImage = String.Empty;</p><p> return true;</p><p> }</p><p> #endregion</p><p></p><p> public override int GetID</p><p> {</p><p> get</p><p> {</p><p> return 5678;</p><p> }</p><p> set</p><p> {</p><p> }</p><p> }</p><p></p><p> public override bool Init()</p><p> {</p><p> return Load(GUIGraphicsContext.Skin + @"\VorlageScreen.xml");</p><p> }</p><p></p><p></p><p> protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)</p><p> {</p><p> if (control == buttonOne)</p><p> OnButtonOne();</p><p> if (control == buttonTwo)</p><p> OnButtonTwo();</p><p> base.OnClicked(controlId, control, actionType);</p><p> }</p><p></p><p> private void OnButtonOne()</p><p> {</p><p> if (contr != null)</p><p> GUIGraphicsContext.VideoWindow = new System.Drawing.Rectangle(contr.XPosition, contr.YPosition, contr.Width, contr.Height);</p><p> g_Player.Play(@"d:\video\test.dvr-ms");</p><p> }</p><p></p><p> private void OnButtonTwo()</p><p> {</p><p> GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);</p><p> dlg.SetHeading("Button has been pressed");</p><p> dlg.SetLine(1, "You pressed button 2");</p><p> dlg.SetLine(2, String.Empty);</p><p> dlg.SetLine(3, String.Empty);</p><p> dlg.DoModal(GUIWindowManager.ActiveWindow);</p><p> }</p><p> }</p><p>}</p><p>[/code]</p><p></p><p>and the screenfile</p><p></p><p>[code]</p><p><window></p><p> <id>5678</id></p><p> <defaultcontrol>2</defaultcontrol></p><p> <allowoverlay>no</allowoverlay></p><p> <controls></p><p> <control></p><p> <description>BackGround</description></p><p> <type>image</type></p><p> <id>1</id></p><p> <posX>0</posX></p><p> <posY>0</posY></p><p> <width>720</width></p><p> <height>576</height></p><p> <texture>background.png</texture></p><p> </control></p><p> <control></p><p> <description>an Image</description></p><p> <type>image</type></p><p> <id>1</id></p><p> <posX>75</posX></p><p> <posY>370</posY></p><p> <texture>hover_my videos.png</texture></p><p> </control></p><p> <control></p><p> <description>text label</description></p><p> <type>label</type></p><p> <id>1</id></p><p> <posX>250</posX></p><p> <posY>70</posY></p><p> <label>Some text</label></p><p> <font>font16</font></p><p> <align>right</align></p><p> <textcolor>ffffffff</textcolor></p><p> </control></p><p> <control></p><p> <description>Try Me</description></p><p> <type>button</type></p><p> <id>2</id></p><p> <posX>60</posX></p><p> <posY>97</posY></p><p> <label>Try Me</label></p><p> <onleft>2</onleft></p><p> <onright>2</onright></p><p> <onup>2</onup></p><p> <ondown>3</ondown></p><p> </control></p><p> <control></p><p> <description>Or Me</description></p><p> <type>button</type></p><p> <id>3</id></p><p> <posX>60</posX></p><p> <posY>131</posY></p><p> <label>Or Me</label></p><p> <onleft>2</onleft></p><p> <onright>2</onright></p><p> <onup>2</onup></p><p> <ondown>2</ondown></p><p> </control></p><p> <control></p><p> <type>videowindow</type></p><p> <description>video window</description></p><p> <id>99</id></p><p> <posX>300</posX></p><p> <posY>107</posY></p><p> <width>220</width></p><p> <height>184</height></p><p> <colordiffuse>ffffffff</colordiffuse></p><p> <onleft>2</onleft></p><p> <onright>2</onright></p><p> </control></p><p> </controls></p><p></window></p><p>[/code]</p><p></p><p>The plugin is working, except I have no videopicture, the videowindow stays black, I only hear sound.</p><p>I tried to play the file with the video module, no problem.</p><p>There is a picture and sound.</p><p></p><p>Perhaps I miss something to initialise or something else, but I dont know what.</p></blockquote><p></p>
[QUOTE="kaybe, post: 37185, member: 12798"] Hello, I am writing a plugin and want to show a video in the middle of the screen. The problem I have is, that there is no picture, only sound. Perhaps someone could help me. I put my code in the plugin template, so its easy to read. To start the player you have to push buttonOne. [code] using System; using System.Windows.Forms; using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Dialogs; namespace OurPlugin { public class Class1 : GUIWindow, ISetupForm { [SkinControlAttribute(2)] protected GUIButtonControl buttonOne = null; [SkinControlAttribute(3)] protected GUIButtonControl buttonTwo = null; [SkinControlAttribute(99)] protected GUIVideoControl contr = null; public Class1() { } #region ISetupForm Members // Returns the name of the plugin which is shown in the plugin menu public string PluginName() { return "MyFirstPlugin"; } // Returns the description of the plugin is shown in the plugin menu public string Description() { return "My First plugin tutorial"; } // Returns the author of the plugin which is shown in the plugin menu public string Author() { return "kaybe"; } // show the setup dialog public void ShowPlugin() { MessageBox.Show("Nothing to configure, this is just an example"); } // Indicates whether plugin can be enabled/disabled public bool CanEnable() { return true; } // get ID of windowplugin belonging to this setup public int GetWindowId() { return 5678; } // Indicates if plugin is enabled by default; public bool DefaultEnabled() { return true; } // indicates if a plugin has its own setup screen public bool HasSetup() { return true; } public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { strButtonText = PluginName(); strButtonImage = String.Empty; strButtonImageFocus = String.Empty; strPictureImage = String.Empty; return true; } #endregion public override int GetID { get { return 5678; } set { } } public override bool Init() { return Load(GUIGraphicsContext.Skin + @"\VorlageScreen.xml"); } protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == buttonOne) OnButtonOne(); if (control == buttonTwo) OnButtonTwo(); base.OnClicked(controlId, control, actionType); } private void OnButtonOne() { if (contr != null) GUIGraphicsContext.VideoWindow = new System.Drawing.Rectangle(contr.XPosition, contr.YPosition, contr.Width, contr.Height); g_Player.Play(@"d:\video\test.dvr-ms"); } private void OnButtonTwo() { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Button has been pressed"); dlg.SetLine(1, "You pressed button 2"); dlg.SetLine(2, String.Empty); dlg.SetLine(3, String.Empty); dlg.DoModal(GUIWindowManager.ActiveWindow); } } } [/code] and the screenfile [code] <window> <id>5678</id> <defaultcontrol>2</defaultcontrol> <allowoverlay>no</allowoverlay> <controls> <control> <description>BackGround</description> <type>image</type> <id>1</id> <posX>0</posX> <posY>0</posY> <width>720</width> <height>576</height> <texture>background.png</texture> </control> <control> <description>an Image</description> <type>image</type> <id>1</id> <posX>75</posX> <posY>370</posY> <texture>hover_my videos.png</texture> </control> <control> <description>text label</description> <type>label</type> <id>1</id> <posX>250</posX> <posY>70</posY> <label>Some text</label> <font>font16</font> <align>right</align> <textcolor>ffffffff</textcolor> </control> <control> <description>Try Me</description> <type>button</type> <id>2</id> <posX>60</posX> <posY>97</posY> <label>Try Me</label> <onleft>2</onleft> <onright>2</onright> <onup>2</onup> <ondown>3</ondown> </control> <control> <description>Or Me</description> <type>button</type> <id>3</id> <posX>60</posX> <posY>131</posY> <label>Or Me</label> <onleft>2</onleft> <onright>2</onright> <onup>2</onup> <ondown>2</ondown> </control> <control> <type>videowindow</type> <description>video window</description> <id>99</id> <posX>300</posX> <posY>107</posY> <width>220</width> <height>184</height> <colordiffuse>ffffffff</colordiffuse> <onleft>2</onleft> <onright>2</onright> </control> </controls> </window> [/code] The plugin is working, except I have no videopicture, the videowindow stays black, I only hear sound. I tried to play the file with the video module, no problem. There is a picture and sound. Perhaps I miss something to initialise or something else, but I dont know what. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
How to play a video?
Contact us
RSS
Top
Bottom