vbaexcelwindows-media-playerwmp

How to display windows media player closed captions on VBA userform


I have embedded a windows media player control onto a VBA userform as an active X control. I can control the video (start, stop, pause etc.) but am unable to display closed captions / subtitles.

It looks like I have to use smi / sami files, however I am unable to get that working... MS documentation seems lacking, more focused on webpages :-(

The following are the 4 (required?) elements for provided by intellisense, all are strings:

me.WindowsMediaPlayer1.closedCaption.captioningId
me.WindowsMediaPlayer1.closedCaption.SAMIFileName = path & "cut.smi" ' Got this one
me.WindowsMediaPlayer1.closedCaption.SAMILang
me.WindowsMediaPlayer1.closedCaption.SAMIStyle

So given the following SAMI file, how should I configure WMP so closed captions will display?

<SAMI>

<HEAD>
<TITLE>SAMI Example</TITLE>

<SAMIParam>
  Media {cut.mp4}
  Metrics {time:ms;}
  Spec {MSFT:1.0;}
</SAMIParam>

<STYLE TYPE="text/css">
<!--
  P { font-family: Arial; font-weight: normal; color: white; background-color: black; text-align: center; }

  #Source {color: red; background-color: blue; font-family: Courier; font-size: 12pt; font-weight: normal; text-align: left; }

  .ENUSCC { name: English; lang: en-US ; SAMIType: CC ; }
  .FRFRCC { name: French;  lang: fr-FR ; SAMIType: CC ; }
-->
</STYLE>

</HEAD>

<BODY>

<!-- Open play menu, choose Captions and Subtiles, On if available -->
<!-- Open tools menu, Security, Show local captions when present -->

<SYNC Start=0>
  <P Class=ENUSCC ID=Source>The Speaker</P>
  <P Class=ENUSCC>SAMI 0000 text</P>

  <P Class=FRFRCC ID=Source>French The Speaker</P>
  <P Class=FRFRCC>French SAMI 0000 text</P>
</SYNC>

<SYNC Start=1000>
  <P Class=ENUSCC>SAMI 1000 text</P>
  <P Class=FRFRCC>French SAMI 1000 text</P>
</SYNC>

<SYNC Start=2000>
  <P Class=ENUSCC>SAMI 2000 text</P>
  <P Class=FRFRCC>French SAMI 2000 text</P>
</SYNC>

<SYNC Start=3000>
  <P Class=ENUSCC>SAMI 3000 text</P>
  <P Class=FRFRCC>French SAMI 3000 text</P>
</SYNC>

</BODY>
</SAMI>

Help much appreciated, thanks.


Solution

  • Didn't find a solution that works for me, but eventually I went for the sanity check.

    Tested WMP in full screen mode and still was unable to play the subtitle file at all; I should have done that before posting. Apparently this is something to do with the video format being mp4...

    The real sanity check was switching to VLC and subtitles displayed no problem, so not a problem with the smi file - but also not a solution for me.

    If you stumbled across this and want subtitles, a solution appears to be downloading a special set of [non-MS] codecs that do allow WMP to display subtitles, but I've not tried this as it is also not a viable solution for me.

    How MS missed this is beyond me - seems so basic, so trivial but there you have it.