private void MediaEL_MediaOpened(object sender, RoutedEventArgs e)
02 {
03 if (MediaEL.NaturalDuration.HasTimeSpan)
04 {
05 TimeSpan ts = MediaEL.NaturalDuration.TimeSpan;
06 seekBar.Maximum = ts.TotalSeconds;
07 seekBar.SmallChange = 1;
08 seekBar.LargeChange = Math.Min(10, ts.Seconds / 10);
09 }
10 timer.Start();
11}
12
or
public MainWindow()
{
BoxedAppSDK.NativeMethods.BoxedAppSDK_Init();
InitializeComponent();
}
private void button2_Click(object sender, RoutedEventArgs e)
{
var MyFileStream = new CustomFileStream(File.ReadAllBytes(@"wildlife.wmv"));
IntPtr ptr = BoxedAppSDK.NativeMethods.BoxedAppSDK_CreateVirtualFileBasedOnIStream(
@"1.wmv",
BoxedAppSDK.NativeMethods.EFileAccess.GenericWrite,
BoxedAppSDK.NativeMethods.EFileShare.Read,
IntPtr.Zero,
BoxedAppSDK.NativeMethods.ECreationDisposition.New,
BoxedAppSDK.NativeMethods.EFileAttributes.Normal,
IntPtr.Zero,
MyFileStream);
using (new SafeFileHandle(ptr, true))
{
mediaElement1.Source = new Uri(Path.GetFullPath("1.wmv"));
mediaElement1.LoadedBehavior = MediaState.Manual;
mediaElement1.Play();
}
}