Hi,
I'm trying to make a plugin which should show a video in a window in the middle of the screen and after switching to another menu item the video should be displayed in a small window in the left corner at the bottom of the screen.
Unfortunately it does not work at all and I am not able to find a explanation how to do this correctly anywhere.
Currently I have a black window, displayed on my screen - showing nothing and hearing nothing.
Is there anybody who could help me please? Many thanks in advance.
This is the code i wrote:
XML-file:
C#:
I'm trying to make a plugin which should show a video in a window in the middle of the screen and after switching to another menu item the video should be displayed in a small window in the left corner at the bottom of the screen.
Unfortunately it does not work at all and I am not able to find a explanation how to do this correctly anywhere.
Currently I have a black window, displayed on my screen - showing nothing and hearing nothing.
Is there anybody who could help me please? Many thanks in advance.
This is the code i wrote:
XML-file:
Code:
<window>
<id>0819</id>
<defaultcontrol>2</defaultcontrol>
<allowoverlay>yes</allowoverlay>
<controls>
...
<control>
<type>videowindow</type>
<description>video window</description>
<id>3001</id>
<posX>300</posX>
<posY>107</posY>
<width>220</width>
<height>184</height>
<colordiffuse>ffffffff</colordiffuse>
<onleft>2</onleft>
<onright>2</onright>
</control>
<control>
<type>button</type>
<description>Play Video</description>
<id>3002</id>
<posX>300</posX>
<posY>300</posY>
<width>20</width>
<height>20</height>
<textcolor>ff000000</textcolor>
<textureFocus>osd_play_focus.png</textureFocus>
<textureNoFocus>osd_play_nofocus.png</textureNoFocus>
</control>
<import>common.facade.video.xml</import>
</controls>
</window>
C#:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using MediaPortal.GUI.Library;
using MediaPortal.Dialogs;
using MediaPortal.Player;
//HANF - Home Automation Interoperability Framework
namespace Hanf_Video
{
public class Video : GUIWindow, ISetupForm
{
[SkinControlAttribute(8000)] protected GUIButtonControl buttonBeenden = null;
[SkinControlAttribute(3002)] protected GUIButtonControl buttonVideo = null;
protected GUIVideoControl contr= null;
public Video(){}
#region ISetupForm Members
public string PluginName()
{
return "HANF Video";
}
public override int GetID
{
get { return 0819;
} set {}
}
...
public bool CanEnable()
{
return true;
}
public int GetWindowId() { return 0819; }
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 false;
}
public bool DefaultEnabled() { return true; }
public override bool Init()
{
return Load(GUIGraphicsContext.Skin + @"\Hanf_Video.xml");
}
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
if (control == buttonBeenden)
OnButtonBeenden();
if (control == buttonVideo)
OnButtonVideo();
base.OnClicked(controlId, control, actionType);
}
private void OnButtonBeenden()
{
GUIWindowManager.CloseCurrentWindow();
GUIWindowManager.ActivateWindow(0);
}
private void OnButtonVideo() {
if (contr != null) GUIGraphicsContext.VideoWindow = new System.Drawing.Rectangle( contr.XPosition, contr.YPosition, contr.Width, contr.Height);
g_Player.Play(@"C:\Program Files\Team MediaPortal\MediaPortal\Skin\BlueTwo\Media\Hanf\picture.mpeg");
}
#endregion
}
}