Giter Site home page Giter Site logo

joran-dob / flutter_subtitle_wrapper Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 60.0 434 KB

This is an subtitle package for flutter video player.

Home Page: https://pub.dev/packages/subtitle_wrapper_package

License: MIT License

Dart 89.87% Kotlin 0.22% Ruby 6.77% Swift 2.72% Objective-C 0.07% HTML 0.35%
accessibility flutter hacktoberfest subtitle-wrapper subtitles video video-player

flutter_subtitle_wrapper's Introduction

Hi there, I'm Joran 👋

flutter_subtitle_wrapper's People

Contributors

bipinct avatar chrgrb avatar georgeprosperr avatar hasanm08 avatar joran-dob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_subtitle_wrapper's Issues

Flutter web exception

Error: Unhandled error XMLHttpRequest error. occurred in Instance of 'SubtitleBloc'.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 909:28 get current
packages/http/src/browser_client.dart 71:22
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1613:54 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 155:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 707:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 736:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 533:7 [_complete]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream.dart 1219:7
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58

at Object.throw_ [as throw] (http://localhost:7390/dart_sdk.js:5041:11)
at http://localhost:7390/packages/bloc/src/bloc_observer.dart.lib.js:155:21
at subtitle_bloc.SubtitleBloc.new.onError (http://localhost:7390/packages/bloc/src/bloc_observer.dart.lib.js:156:28)
at _RootZone.runBinaryGuarded (http://localhost:7390/dart_sdk.js:37227:11)
at sendError (http://localhost:7390/dart_sdk.js:31159:26)
at _BroadcastSubscription.new.[_sendError] (http://localhost:7390/dart_sdk.js:31176:11)
at _BroadcastSubscription.new.[_addError] (http://localhost:7390/dart_sdk.js:31102:27)
at http://localhost:7390/dart_sdk.js:31802:34
at _SyncBroadcastStreamController.new.[_forEachListener] (http://localhost:7390/dart_sdk.js:31652:13)
at _SyncBroadcastStreamController.new.[_sendError] (http://localhost:7390/dart_sdk.js:31801:31)
at _SyncBroadcastStreamController.new.[_addError] (http://localhost:7390/dart_sdk.js:31630:25)
at _RootZone.runBinaryGuarded (http://localhost:7390/dart_sdk.js:37227:11)
at sendError (http://localhost:7390/dart_sdk.js:31159:26)
at _ForwardingStreamSubscription.new.[_sendError] (http://localhost:7390/dart_sdk.js:31176:11)
at _ForwardingStreamSubscription.new.[_addError] (http://localhost:7390/dart_sdk.js:31102:27)
at _ForwardingStreamSubscription.new.[_addError] (http://localhost:7390/dart_sdk.js:35161:25)
at _MapStream.new.[_handleError] (http://localhost:7390/dart_sdk.js:35119:24)
at _ForwardingStreamSubscription.new.[_handleError] (http://localhost:7390/dart_sdk.js:35186:38)
at _RootZone.runBinaryGuarded (http://localhost:7390/dart_sdk.js:37227:11)
at sendError (http://localhost:7390/dart_sdk.js:31159:26)
at _ControllerSubscription.new.[_sendError] (http://localhost:7390/dart_sdk.js:31176:11)
at async._DelayedError.new.perform (http://localhost:7390/dart_sdk.js:34444:27)
at _StreamImplEvents.new.handleNext (http://localhost:7390/dart_sdk.js:34521:15)
at async._AsyncCallbackEntry.new.callback (http://localhost:7390/dart_sdk.js:34282:16)
at Object._microtaskLoop (http://localhost:7390/dart_sdk.js:37526:13)
at _startMicrotaskLoop (http://localhost:7390/dart_sdk.js:37532:13)
at http://localhost:7390/dart_sdk.js:33303:9

Issue with empty lines in the file.

There is an issue with the first empty line. The package displays time 00:00:00.000 --> 00:00:00.500 on the screen after opening instead of an empty line and then it works fine and displaying the text it is the first text line

File sample:

WEBVTT

00:00:00.000 --> 00:00:00.500


00:00:00.500 --> 00:00:02.400
it is the first text line

Package version:
subtitle_wrapper_package: ^1.0.4

How to disable subtitle

How to disable subtitle playback?
I did this with the detach() function, but the playback did not stop

subtitleController.detach();

[request] vtt supports a track of type `metadata` - can flutter_subtitle_wrapper support this?

As you may know already, since writing this VTT parser; the VTT standard supports a variety of track or file types; subtitles, captions, descriptions, chapters and metadata; the key difference being that metadata is used by scripts and not visible to the user.

Would is be difficult to modify this repo's code to support the metadata VTT files and trigger an event that a listener can act upon when the cue position changes?

Update example.

Update the example design to look better and demonstrate the options.

subtitles are not visible when enetering full screen mode

Im using chewie controller, with simple SubStitleWrapper configuration:

SubTitleWrapper( videoPlayerController: _controller, subtitleController: subtitleController, subtitleStyle: SubtitleStyle( textColor: Colors.white, ), videoChild: Chewie( controller: chewieController, ), );

When entering fullscreeen mode in video subtitles are gone.

Add background to subtitle with SubtitleBorderStyle

Is it possible to add a background to subtitle text?

I tried using the subtitle border style property but got some questionable results...

code:

SubTitleWrapper(
  videoPlayerController: _videoPlayerController,
  subtitleController: _subtitleController,
  subtitleStyle: SubtitleStyle(
    fontSize: 25,
    hasBorder: true,
    borderStyle: SubtitleBorderStyle(
      style: PaintingStyle.stroke, // fill didn't work
      color: Color(0x803F444B),
      strokeWidth: 20,
    ),
    textColor: Colors.white,
    position: SubtitlePosition(
      bottom: 150,
    ),
  ),
  videoChild: Chewie(controller: _chewieController),
)

What was expected:
image

What was delivered:
image

Subtitle is not updating If video URL get updated runtime

Hey, @Joran-Dob Thanks for this library. I am working with Chewie Player. I am updating my URL based on resolution get changed.

But the problem is SubTitle didn't get updated after changing the URL.

My URL of the SRT file is the same. I am just changing the Video URL.

I am wrapping my VideoPlayer as below:

        Expanded(
              child: Center(
                child: _chewieController != null
                    ? SubTitleWrapper(
                        videoPlayerController: _chewieController!.videoPlayerController,
                        subtitleController: SubtitleController(
                            subtitleUrl: 'https://raw.githubusercontent.com/pratik7span/sample-srt/master/sample.srt',
                            subtitleType: SubtitleType.srt),
                        subtitleStyle: const SubtitleStyle(textColor: Colors.white, fontSize: 24, hasBorder: true),
                        videoChild: Chewie(
                          controller: _chewieController!,
                        ))
                    : Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: const [
                          CircularProgressIndicator(),
                          SizedBox(height: 20),
                          Text('Loading'),
                        ],
                      ),
              ),
            ),

Do let me know If you need any other details.

Your help would be appreciated.

Does not work

Sorry for the lackluster title.

I am playing an audio file, like in the screenshot below.

There are not subs appearing.

Is there a way for me to debug this?

There seems to be no log.

Screenshot_1715715023

Reset subtitles

Is it ok to request for a feature to reset subtitles to the state they were in when the video started?

With the current Bloc implementation, that would mean yielding an empty state so that the screen is cleared if for example: the video was rewinded with seekTo(Duration.zero)).
Either that or a reset() method could work, too, for when rewinding the video programmatically.

bug: Add legend not work in some videos

Description
After starting Chewie the user can activate the subtitles. In some videos the subtitles are ok, but in others they just don't appear.

This variable is false:
final bool validStartTime = videoPlayerPosition.inMilliseconds >
subtitleItem.startTime.inMilliseconds;

Steps To Reproduce

  1. Play Video
  2. Select legend
  3. Add legend on SubtitleController
  4. but de legend not appear

Expected Behavior
understand why

Screenshots
image

code:

void _initSubtitle(String url, bool show) { subtitleController = SubtitleController( subtitleUrl: url, showSubtitles: show, subtitleType: SubtitleType.webvtt, subtitleDecoder: SubtitleDecoder.utf8, ); setState(() {}); }

@override Widget build(BuildContext context) { if (chewieController != null && playerController != null) { return Theme( data: Theme.of(context).copyWith( bottomSheetTheme: BottomSheetThemeData(backgroundColor: Colors.white), ), child: AspectRatio( aspectRatio: 16 / 9, child: SubtitleWrapper( videoPlayerController: playerController!, subtitleController: subtitleController, subtitleStyle: SubtitleStyle( textColor: Colors.white, hasBorder: true, position: SubtitlePosition(bottom: 10), ), videoChild: Chewie( controller: chewieController!, ), ), ), ); } return AspectRatio( aspectRatio: 16 / 9, child: ShimmerPlaceholderWidget( isRounded: false, width: double.infinity, higth: double.infinity, ), ); }

Support for full screen

Good evening,

this plugins looks pretty cool, thanks a lot!
Sadly it doesn't seem to work with full screen videos (at least at iOS). That is a big disadvantage.
Can we help to get this work somehow?

Kind regards from Germany,
Yorick

Subtitles dont stop when they have to

Description
Subtitles dont stop and disappear when they have to but only when they get replaced by the next subtitle

For example my subtitle

00:00:53.140 --> 00:00:54.710 Better head to work.

should stop at 00:00:54.710 but keeps going until it gets replaced by the next one.

Im loading the subtitles file from url exactly like in the examples:

final SubtitleController subtitleController = SubtitleController( subtitleUrl: "eng.vtt", subtitleType: SubtitleType.webvtt, );

Am i missing something or doing something wrong?
I tried using chewie or just video_player but it keeps happening, am i the only one having this issue?

Landscape subtitle

The plugin now seems not to support the subtitles on landscape mode, so it would be great if fix this

Can we add subtitle from Files?

I want to add subtitles from the file picker and pick vtt files so it will show my subtitles but I cant find a way for this.
Can someone please help me on this.

fix: subtitles does not show when we enter full screen by chewei controller

Description
A clear and concise description of what the bug is.

Steps To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected Behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional Context
Add any other context about the problem here.

fix: Not able update subtitle when switch on second video

Description
A clear and concise description of what the bug is.

Steps To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected Behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional Context
Add any other context about the problem here.

Allow to hide subtitles

In some cases (my case is one of them), we want the user to choose when the subtitles will be displayed. maybe create a function "toggleSubtitlesVisibility" or allow the value of "showSubtitles" attribute to be set.

If already has a way to do that, please add it to the example code.

performance issue loading a long movie vvt file

Hello,

Thanks for this awesome package. I faced a performance issue after loading a large vvt file. It causes the movie to lag behind.
I fixed the issue, so please review what I did and incorporate it into the new version if it's a perfect way to handle this problem.

RegExp for Subtitle Text doesn't match more than two lines of subtitles

It seems that if I plug in the following regular expression for subtitles into a test site like regex101,
((\d{2}):(\d{2}):(\d{2})\,(\d+)) +--> +((\d{2}):(\d{2}):(\d{2})\,(\d{3})).*[\r\n]+\s*((?:(?!\r?\n\r?).)*(\r\n|\r|\n)(?:.*))

The 11th capture group which is used for text will not match more than two lines of text. This is a problem for some subtitles that deliberately newline their subtitles rather than throwing it all in a single line, and mismatches behavior from most video players.

Test String:

22
00:02:25,603 --> 00:02:29,524 
This is an example test string
I will match
I will not

Not being able to change subtitles dynamically

I need to change the subtitle dynamically while playing,
I've put the subtitle url in a variable which I change using setState by pressing a button, but the subtitle doesnt change!
Should I be able to do this? If not what am I doing wrong?

I'm using:
subtitle_wrapper_package: ^1.0.2
chewie: ^0.9.10

Improve general performance

Performance should be improved for both displaying the subtitles as parsing them. Now both are not optimized.

Maintenance, and reported issues.

I was really busy for the last couple of months and lost this project out of side, will give priority to the most pressing issues in the following order:

  1. Checking out open questions/issues.
  2. Fixing deprecation issues/outdated packages.
  3. Code improvements and general bug fixing (might be a while.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.