jhomlala / betterplayer

Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Apache License 2.0
919 stars 981 forks source link

[BUG] Subtitle with two underlines #1106

Closed binhodev closed 1 year ago

binhodev commented 1 year ago

History check Please confirm that you've checked issues history and you didn't find anything which may solve your issue.

Describe the bug When I add subtitles in either SRT or Webvtt, these double lines (underlines) appear.

*Example code

BetterPlayerDataSource dataSource = BetterPlayerDataSource(
        BetterPlayerDataSourceType.network,
        'https://example-url.com/media/01/file.m3u8',
        videoFormat: BetterPlayerVideoFormat.hls,
        cacheConfiguration: const BetterPlayerCacheConfiguration(
          useCache: true,
          preCacheSize: 10 * 1024 * 1024,
          maxCacheSize: 10 * 1024 * 1024,
          maxCacheFileSize: 10 * 1024 * 1024,
        ),
        subtitles: [
          BetterPlayerSubtitlesSource(
              type: BetterPlayerSubtitlesSourceType.network,
              name: 'English',
              urls: [
                 'https://example-url.com/media/01/file.srt',
              ],),
        ]);

Expected behavior That the subtitles were displayed normally.

Screenshots subtitle bug

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.3, on Microsoft Windows [versÆo 10.0.22621.674], locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✗] Visual Studio - develop for Windows
    ✗ Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.72.2)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

Better Player version

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

macopi commented 1 year ago

I found a workarround setting a DefaultTextStyle

example: DefaultTextStyle( child: BetterPlayer(controller: _betterPlayerController), style: const TextStyle(decoration: TextDecoration.none)),

tintran-dev commented 1 year ago

@silvinhofranca This is a case of using a material widget in a non-material parent wedget. to solve the problem you need to wrap a Material widget outside the player:

Material(
    child: BetterPlayer(
        #add some your code
        .................
    ),
);