0

I'm working on a WPF application that displays video clips as part of the workflow. I'm doing this by using MediaElement to play locally hosted (not streamed) AVI files. Works great.

However, I was just handed a new requirement to allow the display of subtitles while the clip is playing. I have no idea of the best way to go about this. I'm vaguely aware that WMP has the ability to display separate subtitle files when a clip is playing, but I don't know if WPF supports this?

Can I do this natively in WPF? If not, what are my options?

My fallback approach would be to require the client to bake the subtitles directly into the video file, but I'd prefer to find a better way to handle this.

4

2 に答える 2

2

字幕の要件が、MediaElement をオーバーレイするテキストだけである場合は、そうです。WPF はこれを確実にサポートできます。MediaElement を TextBlock と共に Grid に配置するだけです。

本当のトリックは、MediaElement の時間に応じて TextBlock Text プロパティを変更することです。しかし、おそらくこれを行う方法はたくさんあります。最初に頭に浮かぶのは、MediaElement.Positionプロパティにバインドされたトリガーを使用することです。

于 2009-07-29T21:02:48.843 に答える
0

WPF では、字幕ファイルを解析して同期する必要があります。Silverlight には MarkerReached のようなイベントはありません。ただし、ビデオと同じファイル名で smi (SAMI ファイル) を作成し、同じフォルダーに入れることができます。次に、ScriptCommand イベントをサブスクライブし、オーバーレイ テキストブロックにコンテンツを表示します。

于 2012-05-23T15:16:31.890 に答える