teyuto_player

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

teyuto player

Teyuto Player SDK for React
Teyuto provides a seamless solution for managing all your video distribution needs. Whether you require video distribution in the cloud, on OTT platforms, storage, public OTT platform distribution, or secure intranet distribution, Teyuto puts everything at your fingertips, making the management of your video content effortless.
Teyuto Flutter Player #
A Flutter plugin for embedding Teyuto videos in your applications.
Getting Started #
This package allows you to embed and control Teyuto videos within your Flutter application. It provides functionalities such as play, pause, seek, and volume control, along with event listeners for playback updates.
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
teyuto_player: ^1.0.1
copied to clipboard
Then run the following command:
flutter pub get
copied to clipboard
Usage #
Basic Integration #
Import the package in your Dart file:
import 'package:teyuto_player/TeyutoPlayer.dart';
copied to clipboard
Use the TeyutoPlayer widget in your widget tree:
import 'package:flutter/material.dart';
import 'package:teyuto_player/TeyutoPlayer.dart';

class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
final GlobalKey<TeyutoPlayerState> _teyutoPlayerKey = GlobalKey();
bool playing = false;
double? time;

void handlePlay() {
print("Video is playing");
setState(() {
playing = true;
});
}

void handlePause() {
print("Video is paused");
setState(() {
playing = false;
});
}

void handleTimeUpdate(double _time) {
setState(() {
time = _time;
});
}

void playPlayer() {
final TeyutoPlayerState? playerState = _teyutoPlayerKey.currentState;
if (playerState != null) {
playerState.play();
setState(() {
playing = true;
});
}
}

void pausePlayer() {
final TeyutoPlayerState? playerState = _teyutoPlayerKey.currentState;
if (playerState != null) {
playerState.pause();
setState(() {
playing = false;
});
}
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Teyuto Player SDK Example'),
),
body: Stack(
children: [
Center(
child: TeyutoPlayer(
key: _teyutoPlayerKey,
obj: {
'id': '46760',
'channel': '30Y8zKKY9H3IUaImUidzCqa5852a1cead3fb2b2ef79cf6baf04909',
'options': {'autoplay': 'on'}
},
onPlay: handlePlay,
onPause: handlePause,
onTimeUpdate: (_time) => handleTimeUpdate(_time),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
playing ? "Playing" : "Pause",
style: const TextStyle(
color: Colors.grey,
),
),
Text(
time?.toString() ?? "",
style: const TextStyle(
color: Colors.grey,
),
),
],
)
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
handleFloatingActionButtonTap();
},
child: playing ? Icon(Icons.pause_circle) : Icon(Icons.play_arrow),
),
),
);
}

void handleFloatingActionButtonTap() {
if (playing) {
pausePlayer();
} else {
playPlayer();
}
}
}

void main() {
runApp(MyApp());
}
copied to clipboard
Player Options #
Customize the player by passing options in the obj parameter:
TeyutoPlayer(
obj: {
'id': 'VIDEO_ID',
'channel': 'CHANNEL_ID',
'options': {
'autoplay': 'on',
'muted': 'off',
'controls': 'on',
// Add more options as needed
}
},
onPlay: () {
print("Video is playing");
},
onPause: () {
print("Video is paused");
},
onTimeUpdate: (double time) {
print("Current time: $time");
},
onVolumeChange: (double volume) {
print("Current volume: $volume");
},
)
copied to clipboard
Controlling the Player #
Programmatically control the player using the provided methods:

play()
pause()
setCurrentTime(double time)
mute()
unmute()
setVolume(double volume)
getCurrentTime()
getVolume()

Example:
void playPlayer() {
final TeyutoPlayerState? playerState = _teyutoPlayerKey.currentState;
if (playerState != null) {
playerState.play();
setState(() {
playing = true;
});
}
}

void pausePlayer() {
final TeyutoPlayerState? playerState = _teyutoPlayerKey.currentState;
if (playerState != null) {
playerState.pause();
setState(() {
playing = false;
});
}
}
copied to clipboard
Event Handling #
Handle various player events using callbacks:
TeyutoPlayer(
obj: {
'id': 'VIDEO_ID',
'channel': 'CHANNEL_ID',
'options': {
'autoplay': 'on',
}
},
onPlay: () {
print("Video is playing");
},
onPause: () {
print("Video is paused");
},
onTimeUpdate: (double time) {
print("Current time: $time");
},
onVolumeChange: (double volume) {
print("Current volume: $volume");
},
)
copied to clipboard
Additional Information #
For more information, visit the pub.dev page for Teyuto Player.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Contact #
For any issues or questions, please contact support@teyuto.com.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.