joran-dob / flutter_subtitle_wrapper Goto Github PK
View Code? Open in Web Editor NEWThis is an subtitle package for flutter video player.
Home Page: https://pub.dev/packages/subtitle_wrapper_package
License: MIT License
This is an subtitle package for flutter video player.
Home Page: https://pub.dev/packages/subtitle_wrapper_package
License: MIT License
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
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 playback?
I did this with the detach() function, but the playback did not stop
subtitleController.detach();
the subtitle not shown when change from portrait to landscape
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?
subtitle hides on full screen
Update the example design to look better and demonstrate the options.
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.
Probaly should add more dynamic styling options to the package.
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),
)
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.
Improve code quility and pipelines.
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.
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
Expected Behavior
understand why
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, ), ); }
Subtitles disappear when the user switches to fullscreen mode.
Its probally a good idea to implement proper parsing for subtitles by following the standard for WebVtt and Srt and not a custom made regex.
WebVtt standard: https://www.w3.org/TR/webvtt1/
Srt standard:
Description
The currently implemented regex parsing only works when the webvtt is in
00:00:00.430 --> 00:00:04.360 (HH:MM:SS format)
it doesn't parse webvtt when it's in
00:07.690 --> 00:08.900 (MM:SS) format
URL to test on
https://s.megastatics.com/subtitle/b0ca076c1289301e0082feb1c6490196/eng-2.vtt
Add styling options to example and host it on Github pages.
Remove last subtile item after time has passed for the last subtitle item in the file, so nothing is displayed.
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
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?
The plugin now seems not to support the subtitles on landscape mode, so it would be great if fix this
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.
Adding Null-Safety to the package: https://medium.com/flutter/null-safety-flutter-tech-preview-cb5c98aba187
Description
A clear and concise description of what the bug is.
Steps To Reproduce
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.
Description
A clear and concise description of what the bug is.
Steps To Reproduce
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.
Hi, Is there a way to load local .vtt file?
Add validation for content-type header and fix for a semicolon. 🚨
Currently, the automatic encoding check does not work if the server adds a semicolon to the content-type header.
The error is correct as to https://tools.ietf.org/html/rfc7231#section-3.1.1.1.
But this behaviour is the default on some CC providers.
Improve testing to include unit testing, widget testing and better coverage.
Also, improve the Github Actions to have auto-deploy to pub and better testing.
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.
For me the subtitle is working fine but i want to be able to open a dictionary link on tapping of the word in a subtitle.
Add widget tests for the package and integrate them with the GitHub actions.
Update Readme and Documentation for the package and project.
Improve pub analyse score. 🥅
Improvements to be made:
❌ 0/10 points: 20% or more of the public API has dartdoc comments
❌ 20/30 points: code has no errors, warnings, lints, or formatting issues
If i want my subtitles to be BOLDED how would i do that?
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.
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
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
There are some API changes:
Performance should be improved for both displaying the subtitles as parsing them. Now both are not optimized.
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:
Add pedantic linting rules.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.