Capture TV Input

Hi dear how can i do to capture the TV in with the client XIbo with windows ? for example i have a pc with a xibo client and the pc have a video card captured. I have connected to the video card my directv connection. I would like to show in XIBO the channel that is being captured at that moment for itself at any time send advertising while people watch a TV channel. is this possible?

Yes and No,
it’s possible but a there is a need for the big source change in software, both player and CMS.

I can do it for a fee.But it’s depends what do you use, custom CMS install or Xibo managed.

George

I used standard CMS iNSTALL WITH cms and uer with windows

Basically here is the steps for CMS and wpf player

I modified the WPF version of Xibo, added VLC addon throught nuget

after that added new usercontrol

<UserControl x:Class="Xibo.Media.VLC"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:Xibo.Media"

         mc:Ignorable="d" 
         d:DesignHeight="450" d:DesignWidth="800">
<Grid Name="videoPanel">

</Grid>

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using Vlc.DotNet.Wpf;
using Xibo.Settings;
namespace Xibo.Media
{
public partial class VLC : UserControl
{
private MediaOption obj;
private VlcControl VlcControl;
private System.Timers.Timer TimerMediaVideo;

    //default durauion region
    double duration = 0;

    MediaFinish _MediaFinish;

    public VLC(MediaOption item, MediaFinish _MediaFinish)
    {
        //videoPanel
        InitializeComponent();
        this.obj = item;
        this._MediaFinish = _MediaFinish;
        Loaded += VideoControl_Loaded;
        Unloaded += VideoControl_Unloaded;
    }

    private void VideoControl_Unloaded(object sender, RoutedEventArgs e)
    {
        VlcControl.SourceProvider.MediaPlayer.EndReached  -= MedaiElemnt_MediaEnded;
        TimerMediaVideo.Stop();
        //medaiElemnt.Stop();
        //  VlcControl.SourceProvider.MediaPlayer.Stop();
        VlcControl.Dispose();

      
        this.videoPanel.Children.Clear();
    }

    private void VideoControl_Loaded(object sender, RoutedEventArgs e)
    {
        try
        {
            ViewVideo();
        }
        catch (Exception ex)        
        {
            PlayerSettings.ErrorLog(ex);
        }
    }


    /// <summary>
    /// View video 
    /// </summary>
    private void ViewVideo()
    {
        //media details
        int mediaId = obj.mediaId;
        string uri = obj.uri;
        int _top = obj.top;
        int _left = obj.left;
        if (obj.type == "videoin")
        {
            uri = "dshow://";
        }
        string _filePath = Uri.UnescapeDataString(uri).Replace('+', ' ');


        duration = obj.duration;
        if (duration == 0)
        {
            TimeSpan videoDuration = PlayerSettings.GetVideoDuration(_filePath);
            duration = videoDuration.TotalSeconds;
        }

        //transition IN details
        string transIn = obj.transIn;
        string transInDirection = obj.transInDirection;
        double transInDuration = obj.transInDuration;

        duration += (transInDuration / 1000);

        //transition OUT details
        string transOut = obj.transOut;
        string transOutDirection = obj.transOutDirection;
        double transOutDuration = obj.transOutDuration;

        duration += (transOutDuration / 1000);


        //         medaiElemnt.MediaPlayer.VlcLibDirectoryNeeded += vlcControl_VlcLibDirectoryNeeded;
        //medaiElemnt.MediaPlayer.Play(_filePath); 
        VlcControl = new VlcControl();
        var currentAssembly = Assembly.GetEntryAssembly();
        var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
        var libDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
        if (obj.type == "videoin")
        {
            string[] VlcOption = { "--dummy-quiet", "--ignore-config", "--no-video-title", "--no-sub-autodetect-file", "--file-caching=1000", "--live-caching=1000", "--network-caching=1000" };
            string[] digits = System.Text.RegularExpressions.Regex.Split(Uri.UnescapeDataString(obj.uri).Replace("+", ""), @" :");
            //
            // Now we have each number string.
            //
            if (digits.Length > 2)
            {
                foreach (string a in digits)
                {
                    if (a != "")
                    {
                        Array.Resize(ref VlcOption, VlcOption.Length + 1);
                        VlcOption[VlcOption.Length - 1] = "--" + a.Replace("\\", "").Replace(":d", "d");
                    }

                }


                this.VlcControl.SourceProvider.CreatePlayer(libDirectory, VlcOption);
                this.VlcControl.SourceProvider.MediaPlayer.Play(new Uri(_filePath));
            }
          
        }
        else
        {
            string[] VlcOption = { "--dummy-quiet", "--ignore-config", "--no-video-title", "--no-sub-autodetect-file", "--file-caching=1000", "--live-caching=1000", "--network-caching=1000" };
            this.VlcControl.SourceProvider.CreatePlayer(libDirectory, VlcOption);
            this.VlcControl.SourceProvider.MediaPlayer.Play(new Uri(_filePath));
        }


        int volume = 0;
        if (obj.mute == 1)
        {
            volume = 0;
        }
        else
        {
            volume = 100;
        }
        VlcControl.SourceProvider.MediaPlayer.Audio.Volume = volume;
        if (obj.loop == 1)
        {
           
            VlcControl.SourceProvider.MediaPlayer.EndReached  += MedaiElemnt_MediaEnded;
        }

        this.videoPanel.Children.Add(VlcControl);

        TimerMediaVideo = new System.Timers.Timer();
        TimerMediaVideo.Elapsed += new ElapsedEventHandler(MediaTimer_Tick);
        TimerMediaVideo.Interval = 1000 * duration;
        TimerMediaVideo.Start();

        if (transIn != null)
        {
            MediaSupport.MoveAnimation(VlcControl, OpacityProperty, transIn, transInDirection, transInDuration, "in", _top, _left);
        }
        double transOutStartTime = duration - (transOutDuration / 1000);
        if (transOut != null)
        {
            var timerTransition = new DispatcherTimer { Interval = TimeSpan.FromSeconds(transOutStartTime) };
            timerTransition.Start();
            timerTransition.Tick += (sender1, args) =>
            {
                timerTransition.Stop();
                MediaSupport.MoveAnimation(VlcControl, OpacityProperty, transOut, transOutDirection, transOutDuration, "out", _top, _left);
            };
        }
    }

    private void MediaTimer_Tick(object sender, ElapsedEventArgs e)
    {
        CallToBackRegion();
        TimerMediaVideo.Stop();
    }
    //private void vlcControl_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
    //{
    //    var currentAssembly = Assembly.GetEntryAssembly();
    //    var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
    //    // Default installation path of VideoLAN.LibVLC.Windows
    //    e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
    //}

    private void MedaiElemnt_MediaEnded(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
    {
        try
        {
          
          VlcControl.SourceProvider.MediaPlayer.Play();
        }
        catch
        {
          
        }

    }

    /// <summary>
    /// Call Back to Region
    /// </summary>
    private void CallToBackRegion()
    {
        int mediaId = Convert.ToInt16(obj.mediaId);
        if (_MediaFinish != null)
        {
            _MediaFinish(mediaId);

        }
    }
}

}

and modified ParentControl.xaml.cs
added

case “videoin”:
RenderVLC(index);
break;

and

case “localvideo”:
if (MediaList[index].uri.Contains(“rtmp”))
{
RenderVLC(index);
}
else
{
RenderLocalVideo(index);
}

break;

to switches

and new VOID

private void RenderVLC(int index)
{
//media details
MediaFinish = new MediaFinish(CompleateMedia);

        VLC localVideo = new VLC(MediaList[index], MediaFinish);
        this.LayoutPanel.Children.Add(localVideo);
    }

after that modified the CMS file so I can send any command through
edited files are
videoin-form-add.twig and videoin-form-edit.twig
I have edited the form

{% set title %}{% trans “Name” %}{% endset %}
{% set helpText %}{% trans “Direct Show VLC Edit Options.” %}{% endset %}
{{ forms.input(“sourceId”, title, module.getOption(“sourceId”), helpText, “”, required) }}

instead of

{% set title %}{% trans “Input” %}{% endset %}
{% set helpText %}{% trans “Which device input should be shown” %}{% endset %}
{% set hdmi %}{% trans “HDMI” %}{% endset %}
{% set rgb %}{% trans “RGB” %}{% endset %}
{% set dvi %}{% trans “DVI” %}{% endset %}
{% set dp %}{% trans “DP” %}{% endset %}
{% set ops %}{% trans “OPS” %}{% endset %}
{% set options = [
{ sourceId: hdmi, source: hdmi },
{ sourceId: rgb, source: rgb },
{ sourceId: dvi, source: dvi },
{ sourceId: dp, source: dp },
{ sourceId: ops, source: ops }
] %}
{{ forms.dropdown(“sourceId”, “single”, title, module.getOption(“sourceId”), options, “sourceId”, “source”, helpText, “”, “required”) }}

and then you can send direct VLC commands.

and the add this line to video in form

Thats it.

Hi dear; thank you so much i m going to do the test and commented.

Regards;

hey,
could you explain this installation for a Linux Docker installation of Xibo?