Coder Social home page Coder Social logo

nikashanin / instagram_video_story_share Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aytunch/instagram_video_story_share

0.0 0.0 0.0 2.98 MB

A Flutter Plugin for iOS which shares a video file to be posted as an Instagram Story

License: MIT License

Ruby 18.97% Objective-C 7.04% Dart 41.64% Swift 32.34%

instagram_video_story_share's Introduction

instagram_video_story_share

A Flutter Plugin for iOS which shares a video file to be posted as an Instagram Story

We needed a way to share videos for our social media app in Instagram stories like TikTok is doing but we could not find a plugin which allows this.

You can check the live functionality by installing our app

Sponty: Spontaneous social gatherings

Sponty Logo

All the other plugins supported images and the ones supporting videos were only sharing to Instagram Feed and not Stories.

This API from "Facebook for developers" is followed while implementing the plugin:

Sharing to Stories

If the community asks for it, we can add functionality for editable stickers in Instagram stories to be passed from Flutter

This plugin is only for iOS

PR's for Android offering same functionality are welcome

Video story share on Instagram

insta story share demo

iOS Configuration

Set your minimum iOS version to 10.0 or higher

Add this to your Info.plist to use share on instagram stories

<key>LSApplicationQueriesSchemes</key>
	<array>
	<string>instagram-stories</string>
	</array>

Usage

To check if Instagram is installed:

bool isInstagramInstalled = await InstagramVideoStoryShare.instagramInstalled;

To share a video in your Instagram Stories:

bool success = await InstagramVideoStoryShare.share(videoPath: myVideoPath);

To get the video path you might need to use path_provider package as seen in the example project:

  # in your pubspec.yaml file add this:
  path_provider: ^2.0.2
  import 'dart:io';
  import 'package:path_provider/path_provider.dart';

  Future<String> videoFilePath() async {
    ByteData bytes = await rootBundle.load("assets/$videoName");
    String dir = (await getApplicationDocumentsDirectory()).path;
    File file = await writeToFile(bytes, '$dir/$videoName');
    return file.path;
  }

  Future<File> writeToFile(ByteData data, String path) async {
    final buffer = data.buffer;
    File file = await File(path).writeAsBytes(
        buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
    return file;
  }

instagram_video_story_share's People

Contributors

aytunch avatar nikashanin avatar

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.