vdotok_stream 0.0.11 copy "vdotok_stream: ^0.0.11" to clipboard
vdotok_stream: ^0.0.11 copied to clipboard

outdated

By using this package you can connect with vdotok and use vdotok services. you can make one 2 one, many 2 many, Group calls , broadcast etc.

example/lib/main.dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:vdotok_stream/vdotok_stream.dart';
import 'package:vdotok_stream_example/src/core/providers/call_provider.dart';
import 'package:vdotok_stream_example/src/core/providers/contact_provider.dart';
import 'package:vdotok_stream_example/src/core/providers/groupListProvider.dart';
import 'src/core/providers/auth.dart';

import 'src/home/homeIndex.dart';
import 'src/login/SignInScreen.dart';
import 'src/routing/routes.dart';
import 'src/splash/splash.dart';
import 'package:provider/provider.dart';
import 'constant.dart';

class MyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext context) {
    return super.createHttpClient(context)
      ..badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;
  }
}

void main() {
  HttpOverrides.global = new MyHttpOverrides();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => AuthProvider()..isUserLogedIn()),
        ChangeNotifierProvider(create: (_) => CallProvider()),
        ChangeNotifierProvider(create: (_) => ContactProvider()),
        ChangeNotifierProvider(create: (_) => GroupListProvider()),
      ],
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Vdotok Video',
        theme: ThemeData(
            colorScheme: ColorScheme.fromSwatch(
              primarySwatch: Colors.grey,
            ).copyWith(),
            accentColor: primaryColor,
            primaryColor: primaryColor,
            scaffoldBackgroundColor: Colors.white,
            textTheme: TextTheme(
              bodyText1: TextStyle(color: secondaryColor),
              bodyText2: TextStyle(color: secondaryColor), //Text
            )),
        onGenerateRoute: Routers.generateRoute,
        home: Consumer<AuthProvider>(
          builder: (context, auth, child) {
            if (auth.loggedInStatus == Status.Authenticating)
              return SplashScreen();
            else if (auth.loggedInStatus == Status.LoggedIn) {
              return
                  // HomeIndex();
                  Test();
            } else
              return
                  // SignInScreen();
                  Test();
          },
        ),
      ),
    );
  }
}

class Test extends StatefulWidget {
  @override
  _TestState createState() => _TestState();
}

class _TestState extends State<Test> {
  SignalingClient signalingClient;
  MediaStream _localStream;
  RTCVideoRenderer _localRenderer = new RTCVideoRenderer();
  @override
  void initState() {
    // TODO: implement initState

    initRenderers();

    signalingClient = SignalingClient.instance;
    // signalingClient.methodInvoke();
    super.initState();

    signalingClient.onLocalStream = (stream) {
      print("this is local stream ${stream.id}");
      setState(() {
        _localRenderer.srcObject = stream;
      });
    };
    // signalingClient.getPermissions();
  }

  initRenderers() async {
    await _localRenderer.initialize();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              width: 200,
              height: 300,
              child: _localRenderer.srcObject == null
                  ? Text("text")
                  : RTCVideoView(_localRenderer, mirror: false),
            ),
            RaisedButton(
              onPressed: () {
                signalingClient.getNumber();
              },
              child: Text("Create peerConnection"),
            ),
            RaisedButton(
              onPressed: () {
                signalingClient.creteOffermannual();
              },
              child: Text("createOffer"),
            ),
            RaisedButton(
              onPressed: () {
                signalingClient.getMedia();
              },
              child: Text("getUserMedia"),
            ),
            RaisedButton(
              onPressed: () {
                signalingClient.getDisplay();
              },
              child: Text("getUserDisplayMedia"),
            ),
            RaisedButton(
              onPressed: () {
                // signalingClient.getinternal();
              },
              child: Text("getInternalAudio"),
            )
          ],
        ),
      ),
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

verified publishervdotok.com

By using this package you can connect with vdotok and use vdotok services. you can make one 2 one, many 2 many, Group calls , broadcast etc.

License

unknown (license)

Dependencies

connectivity_plus, crypto, dart_ipify, device_info, flutter, flutter_device_type, flutter_foreground_plugin, http, media_projection_creator, path_provider, permission_handler, replay_kit_launcher, web_socket_channel, wifi_info_flutter

More

Packages that depend on vdotok_stream