You can also use Windows Presentation Foundation (WPF) and its wrapper around Windows Media Player. I think WMP 10 or higher is required. I have WMP 11 and it this works with both the sample .wma and a random .mp3 file from the web.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#light

#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll"
#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll"

open System
open System.IO
open System.Windows.Media
let mp = new MediaPlayer()

//let file = @"D:\tmp\drancing_fm_snippet.mp3"
let file = @"C:\Documents and Settings\All Users\Documents\My Music\Sample Music\Beethoven's Symphony No. 9 (Scherzo).wma"

mp.Open(new Uri(file))
mp.Play()
//mp.Stop()
By on 6/17/2008 4:23 PM ()

Any recommendations on which approach is more likely to work with Mono?

(I think using the MediaPlayer won't work at all, but will the 1st? )

Also, where is the proper place to find Microsoft.DirectX.AudioVideoPlayback.dll? Is that in the DirectX SDK?

Thanks in advance,

By on 11/20/2008 6:43 AM ()

I found a reference to:
[link:www.mono-project.com]

To do media on Linux. (When audio actually works :))

If you meant Mono on Windows (not sure why this would be a target), then the DirectX one has a lot more possibility, as there's very little WPF support in Mono Windows. (Although perhaps Moonlight libs have something...)

Heck, you may be able to even reference the MS WPF libs and run them on Mono.

I suggest you use MOMA to determine what things will work in an assembly:
[link:www.mono-project.com]

By on 11/22/2008 6:28 PM ()

You can use DirectX:

1
2
3
4
5
#r "c:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.AudioVideoPlayback.dll";;
open Microsoft.DirectX.AudioVideoPlayback;;
let s = ... path to your file...;;
let a = new Audio(s);;
a.Play();;
By on 6/17/2008 9:58 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper