Well, opening the file as AVAssetMBS may load the header and define if it works or not.
This is simply not a rule you can rely upon: I have some WMV files that play fine on OS X natively, and I have some .MOV files that play fine on Windows. I also have some MOV files which used to play fine on OS X but no longer do, and I have some MOV files which play in QuickTime Player 7 but not QuickTime Player X (presumably as the former uses QuickTime and the latter uses AVFoundation). Apple giveth and Apple taketh away.
I think the idea of loading the movie and seeing if you get a valid Duration is not a bad idea; however I’ve also seen MOV files that use the Animation codec which will play once, but on the second loop the time value is bogus.
you will need to actually open them in order to know if the codec for the file is found.
And that’s determinated when loading.
like this:
[code] dim f as FolderItem = SpecialFolder.Desktop.Child(“test.wmv”)
dim a as AVAssetMBS = AVAssetmbs.assetWithFile(f)
if a = nil then
MsgBox “failed to read file at all”
Return
end if
a.loadValuesAsynchronouslyForKeys array(“duration”)
dim e as NSErrorMBS
dim Status as integer = a.statusOfValueForKey(“duration”, e)
while status < a.AVKeyValueStatusLoaded
// wait
status = a.statusOfValueForKey(“duration”, e)
wend
if status <> a.AVKeyValueStatusLoaded then
MsgBox “Failed to load duration.”
if e <> nil then
MsgBox e.LocalizedDescription
end if
else
MsgBox str(a.duration.Seconds)+" seconds long."
end if
[/code]