RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
224 stars 27 forks source link

Support for WebVTT Cue Settings #954

Open christianYS opened 2 years ago

christianYS commented 2 years ago

AvPro supports displaying WebVTT subtitles when streaming with HLS (supported platforms are shown in the documentation). However, only the text is available for displaying. WebVTT format allows to specify extra settings for controlling the appearance of the text cue on the screen, which is not supported by AvPro. these settings are: vertical, line, position, size, align. A more in-deep description of these settings can be found here

Example 1:

WEBVTT

1
00:00:00.000 --> 00:00:04.000 position:10%,line-left align:left size:35%
A Long Time Ago in a Galaxy Far, Far Away... 

Example 2: The Apple BipBop example has WebVTT subtitles with Cue Settings. https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8

Describe the solution you'd like I'd like to have a way to access the Cue Settings together with the text Cue. For example, they can be included in the class TextCue as a List<CueSetting>, where CueSetting would represent a single cue setting.

Describe alternatives you've considered An alternative solution would be to serve subtitles that contain custom tags, for example <settings size:30%, align:left>Subtitle here</settings> and then write a custom parser for them. But this approach would not work if we had to display the content with a different player, or we have to show an already existing stream we don't have control over.

AndrewRH commented 2 years ago

This may be possible on Windows by adding support for this API: https://docs.microsoft.com/en-us/windows/win32/api/mfmediaengine/nn-mfmediaengine-imftimedtextregion