Embedding a VLC window in a Powershell GUI

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
EdwinE
Blank Cone
Blank Cone
Posts: 17
Joined: 12 Jun 2015 09:34

Embedding a VLC window in a Powershell GUI

Postby EdwinE » 12 Jun 2015 09:58

Hi,
i'm writing a bit of code to display a slideshow on a windows 7 machine by using Powershell.
I was wondering if it's possible to trigger the vlc player in an embedded powershell gui. If possible i can opt between a standard slide show or show a video file.

At the moment i haven't found the appropriate code to use VLC. I've only got code to trigger wmp which i dislike ( otherwise i'd not be an avid VLC fan ).

Is there anyone who's already tried this & succeeded?

What i'd like is something that looks like this but with the possibility to define start / stop / pause & play again buttons in the window

Image

The most basic code i have to trigger WMP is this

Code: Select all

$wmp = New-Object -ComObject WMPlayer.OCX $wmp.openPlayer("c:\temp\test.mp4")
I've found other code but it requires i use XML

The code i'm trying to adapt comes from rakatechblog.wordpress.com

Code: Select all

#WPF Library for Playing Movie and some components Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName System.ComponentModel #XAML File of WPF as windows for playing movie [xml]$XAML = @" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="PowerShell Video Player" Height="355" Width="553" ResizeMode="NoResize"> <Grid Margin="0,0,2,3"> <MediaElement Height="250" Width="525" Name="VideoPlayer" LoadedBehavior="Manual" UnloadedBehavior="Stop" Margin="8,10,10,61" /> <Button Content="Pause" Name="PauseButton" HorizontalAlignment="Left" Margin="236,283,0,0" VerticalAlignment="Top" Width="75"/> <Button Content="Play" Name="PlayButton" HorizontalAlignment="Left" Margin="236,283,0,0" VerticalAlignment="Top" Width="75"/> </Grid> </Window> "@ #Movie Path [uri]$VideoSource = "C:UsersRakaDownloadsHiVi! - Orang Ke-3 Official MV HD.mp4" #Devide All Objects on XAML $XAMLReader=(New-Object System.Xml.XmlNodeReader $XAML) $Window=[Windows.Markup.XamlReader]::Load( $XAMLReader ) $VideoPlayer = $Window.FindName("VideoPlayer") $PauseButton = $Window.FindName("PauseButton") $PlayButton = $Window.FindName("PlayButton") #Video Default Setting $VideoPlayer.Volume = 100; $VideoPlayer.Source = $VideoSource; $VideoPlayer.Play() $PauseButton.Visibility = [System.Windows.Visibility]::Visible $PlayButton.Visibility = [System.Windows.Visibility]::Hidden #Button click event $PlayButton.Add_Click({ $VideoPlayer.Play() $PauseButton.Visibility = [System.Windows.Visibility]::Visible $PlayButton.Visibility = [System.Windows.Visibility]::Hidden }) $PauseButton.Add_Click({ $VideoPlayer.Pause() $PauseButton.Visibility = [System.Windows.Visibility]::Hidden $PlayButton.Visibility = [System.Windows.Visibility]::Visible }) #Show Up the Window $Window.ShowDialog() | out-null
Any suggestions are welcome.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Embedding a VLC window in a Powershell GUI

Postby Jean-Baptiste Kempf » 17 Jul 2015 00:35

No idea. Maybe the ActiveX?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 45 guests