2012-08-09 09:45:04 +00:00
|
|
|
using System;
|
2012-01-16 20:08:38 +00:00
|
|
|
using ANX.Framework.Graphics;
|
2012-10-10 10:48:19 +00:00
|
|
|
using ANX.Framework.NonXNA.Development;
|
2011-11-17 20:35:25 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
2011-11-17 20:35:25 +00:00
|
|
|
|
|
|
|
namespace ANX.Framework.Media
|
|
|
|
{
|
2012-10-10 10:48:19 +00:00
|
|
|
[PercentageComplete(50)]
|
|
|
|
[Developer("AstrorEnales")]
|
|
|
|
[TestState(TestStateAttribute.TestState.Untested)]
|
2012-01-16 20:08:38 +00:00
|
|
|
public sealed class VideoPlayer : IDisposable
|
2011-11-17 20:35:25 +00:00
|
|
|
{
|
2012-09-30 07:43:41 +00:00
|
|
|
private float volume;
|
|
|
|
internal float VolumeToUse
|
|
|
|
{
|
|
|
|
get { return IsMuted ? 0f : volume; }
|
|
|
|
}
|
2012-01-16 20:08:38 +00:00
|
|
|
|
2012-09-30 07:43:41 +00:00
|
|
|
public Video Video { get; private set; }
|
|
|
|
public bool IsMuted { get; set; }
|
|
|
|
public bool IsDisposed { get; private set; }
|
2012-01-16 20:08:38 +00:00
|
|
|
|
2012-09-30 07:43:41 +00:00
|
|
|
public TimeSpan PlayPosition
|
2012-01-16 20:08:38 +00:00
|
|
|
{
|
2012-09-30 07:43:41 +00:00
|
|
|
get { return Video == null ? TimeSpan.Zero : Video.PlayPosition; }
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
2012-09-30 07:43:41 +00:00
|
|
|
public float Volume
|
2012-01-16 20:08:38 +00:00
|
|
|
{
|
2012-09-30 07:43:41 +00:00
|
|
|
get { return volume; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value < 0f || value > 1f)
|
|
|
|
throw new ArgumentOutOfRangeException("value");
|
|
|
|
|
|
|
|
volume = value;
|
|
|
|
}
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsLooped
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
}
|
2012-09-30 07:43:41 +00:00
|
|
|
|
2012-01-16 20:08:38 +00:00
|
|
|
public MediaState State
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-26 10:31:54 +00:00
|
|
|
public VideoPlayer()
|
|
|
|
{
|
2012-09-30 07:43:41 +00:00
|
|
|
IsMuted = false;
|
|
|
|
volume = 1f;
|
2012-08-26 10:31:54 +00:00
|
|
|
IsDisposed = false;
|
|
|
|
}
|
|
|
|
|
2012-01-16 20:08:38 +00:00
|
|
|
~VideoPlayer()
|
|
|
|
{
|
|
|
|
Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
2012-09-30 07:43:41 +00:00
|
|
|
if (IsDisposed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
IsDisposed = true;
|
|
|
|
Video = null;
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Play(Video video)
|
2012-09-30 07:43:41 +00:00
|
|
|
{
|
|
|
|
if (video == null)
|
|
|
|
throw new ArgumentNullException("video");
|
|
|
|
|
|
|
|
Video = video;
|
|
|
|
video.Play();
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Pause()
|
2012-09-30 07:43:41 +00:00
|
|
|
{
|
|
|
|
if (Video != null)
|
|
|
|
Video.Pause();
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Resume()
|
2012-09-30 07:43:41 +00:00
|
|
|
{
|
|
|
|
if (Video != null)
|
|
|
|
Video.Resume();
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Stop()
|
2012-09-30 07:43:41 +00:00
|
|
|
{
|
|
|
|
if (Video != null)
|
|
|
|
Video.Stop();
|
2012-01-16 20:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public Texture2D GetTexture()
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
2011-11-17 20:35:25 +00:00
|
|
|
}
|
|
|
|
}
|