how can I show a video in my own plugin??? (1 Viewer)

Naty

New Member
May 2, 2007
4
0
Home Country
Austria Austria
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:
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
    }
}
 

moiristo

Portal Pro
November 17, 2006
342
27
Enschede
Home Country
Netherlands Netherlands
I guess it's because you both have a videowindow and 'allowoverlay' to 'yes' in one skin file. If you go to another menu, I think you should load another xml file that has no videowindow, but with allowoverlay set to 'yes'
 

Naty

New Member
May 2, 2007
4
0
Home Country
Austria Austria
Hi,
I think I described my problem not so good - the problem is momentarily not that the small window in the left corner is not shown, because it cannot be shown because the video in the big window does not even start. Did I forget anything in order to see the video? Some tiny basic thing because I'm totally new in developing mp?
Maybe there are some tutorials, a SDK or a description how to put a video or other basic thing into MP? Because in team-mediaportal.com I have not found anything concerning this topic.
TIA
Naty
 

Users who are viewing this thread

Top Bottom