has_audio 0.0.9 copy "has_audio: ^0.0.9" to clipboard
has_audio: ^0.0.9 copied to clipboard

A Flutter plugin for checking if a video file contains an audio track.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:has_audio/has_audio.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool hasAudio = false;
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    bool check;

    check = await HasAudio.check("path/to/video.mp4");

    if (!mounted) return;

    setState(() {
      hasAudio = check;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Check video has audio'),
        ),
        body: Center(
          child: Text('has audio: $hasAudio\n'),
        ),
      ),
    );
  }
}
4
likes
150
points
39
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for checking if a video file contains an audio track.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on has_audio