video_launcher 0.2.0

  • README.md
  • Example
  • Installing
  • Versions
  • 24

VideoLauncher #

Usage #

To use this plugin, add video_launcher as a dependency in your pubspec.yaml file.

Example #

After importing 'package:video_launcher/video_launcher.dart' the directories can be queried as follows

To launch a video :

Future<Null> _launch(String url) async {
    if (await canLaunchVideo(url)) {
      await launchVideo(url);
    } else {
      throw 'Could not launch $url';
    }
  }

To play a local video file :

Future<Null> _launch(String url) async {
    if (await canLaunchVideo(url, isLocal:true)) {
      await launchVideo(url, isLocal:true);
    } else {
      throw 'Could not launch $url';
    }
  }

Please see the example app of this plugin for a full example.

Getting Started #

For help getting started with Flutter, view our online documentation.

example/lib/main.dart

// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:video_launcher/video_launcher.dart';

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

const videoUrl = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'URL Launcher',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'URL Launcher'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Future<Null> _launched;

  void _launchUrl() {
    setState(() {
      _launched = _launch(videoUrl);
    });
  }

  Future<Null> _launch(String url) async {
    if (await canLaunchVideo(url)) {
      await launchVideo(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  Widget _launchStatus(BuildContext context, AsyncSnapshot<Null> snapshot) {
    if (snapshot.hasError) {
      return new Text('Error: ${snapshot.error}');
    } else {
      return const Text('');
    }
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new Center(
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                new Padding(
                  padding: new EdgeInsets.all(16.0),
                  child: new Text(videoUrl),
                ),
                new RaisedButton(
                  onPressed: _launchUrl,
                  child: new Text('Go'),
                ),
              ],
            ),
            new FutureBuilder<Null>(future: _launched, builder: _launchStatus),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  video_launcher: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:video_launcher/video_launcher.dart';
  
Version Uploaded Documentation Archive
0.3.0 Sep 6, 2017 Go to the documentation of video_launcher 0.3.0 Download video_launcher 0.3.0 archive
0.2.2 May 25, 2017 Go to the documentation of video_launcher 0.2.2 Download video_launcher 0.2.2 archive
0.2.1 May 16, 2017 Go to the documentation of video_launcher 0.2.1 Download video_launcher 0.2.1 archive
0.2.0+1 May 15, 2017 Go to the documentation of video_launcher 0.2.0+1 Download video_launcher 0.2.0+1 archive
0.2.0 May 15, 2017 Go to the documentation of video_launcher 0.2.0 Download video_launcher 0.2.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
24
Learn more about scoring.

This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.