Coder Social home page Coder Social logo

Comments (3)

abdelaziz-mahdy avatar abdelaziz-mahdy commented on July 22, 2024 1

@SeongWoo-97 did you check this??https://github.com/zezo357/flutter_meedu_videoplayer/blob/master/package/example/lib/pages/network_with_subtitle_page.dart

you have to call _controller.onClosedCaptionEnabled(true); to show captions

from flutter_meedu_videoplayer.

abdelaziz-mahdy avatar abdelaziz-mahdy commented on July 22, 2024

Hello, I have a problem with my video player. The video works fine, but the captions are not displaying. I've checked the documentation, but it's hard to find any information about captions. Here is a part of the code I've written:
` _init() async {
final result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['mp4', 'srt'],
allowMultiple: true,
);

if (result != null) {
  File? videoFile;
  File? srtFile;

  for (var file in result.files) {
    if (file.extension == 'mp4') {
      videoFile = File(file.path!);
    } else if (file.extension == 'srt') {
      srtFile = File(file.path!);
    }
  }

  if (videoFile != null) {
    Future<ClosedCaptionFile>? subRipCaptionFileFuture;
    if (srtFile != null) {
      subRipCaptionFileFuture = _loadSubRipCaptionFile(srtFile);
    }

    _meeduPlayerController.setDataSource(
      DataSource(
        type: DataSourceType.file,
        file: videoFile,
        closedCaptionFile: subRipCaptionFileFuture,
      ),
      autoplay: true,
    );
  }
}

}

Future _loadSubRipCaptionFile(File srtFile) async {
final srtContent = await srtFile.readAsString();
return SubRipCaptionFile(srtContent);
}
`
I would appreciate any help or guidance on how to display captions in the video player. Thanks in advance!

That's on the desktop? I didn't really implement it there,but I will try to check on it and let you know.

from flutter_meedu_videoplayer.

abdelaziz-mahdy avatar abdelaziz-mahdy commented on July 22, 2024

Can you provide the caption file?

from flutter_meedu_videoplayer.

Related Issues (20)

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.