src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
changeset 119 7a370bfb4d77
parent 77 e95e916eb018
child 121 32611257e99f
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Thu Sep 24 18:13:36 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Thu Sep 24 18:30:56 2009 +0200
@@ -21,12 +21,18 @@
 
         public event EventHandler PlayerOpened;
 
-		public UserControlPlayer()
-		{
-			this.InitializeComponent();
+        public UserControlPlayer()
+        {
+            this.InitializeComponent();
             initPlayer();
         }
 
+        public UserControlPlayer(string path)
+        {
+            this.InitializeComponent();
+            initPlayer(path);
+        }
+
         #region Properties
         public double TotalMilliseconds
         {
@@ -65,6 +71,18 @@
             MediaElementVideo.ScrubbingEnabled= true;
         }
 
+        public void initPlayer(string path)
+        {
+            //init player
+            isPlaying = false;
+            //Pour se diriger vers le Dossier ressources du projet et non le bin/ressources
+            //DirectoryInfo info = Directory.GetParent(@".");
+            MediaElementVideo.Source = new Uri(path, UriKind.Relative);
+            MediaElementVideo.LoadedBehavior = MediaState.Manual;
+            MediaElementVideo.UnloadedBehavior = MediaState.Manual;
+            MediaElementVideo.ScrubbingEnabled = true;
+        }
+
         public void playerPause()
         {
             MediaElementVideo.Pause();