Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

youtube live streaming #163

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ jobs:
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > android/app/google-services.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart

- name: Install dependencies
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ jobs:
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}

CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart

- name: Install Dependencies
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/android_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ jobs:
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}

CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart

- name: Install Dependencies
run: |
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/function_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,21 @@ jobs:
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
ENVIRONMENT_VARIABLE_BASE64: ${{ secrets.ENVIRONMENT_VARIABLE_BASE64 }}
run: |
cd khelo
echo $GOOGLE_APPLICATION_CREDENTIALS | base64 --decode > functions/google-application-credentials.json
echo $GOOGLE_APPLICATION_CREDENTIALS | base64 --decode > google-application-credentials.json
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
echo $ENVIRONMENT_VARIABLE_BASE64 | base64 --decode > functions/.env

- name: Deploy Firebase functions
run: |
cd khelo
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/functions/google-application-credentials.json
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/google-application-credentials.json
firebase deploy --only functions --debug

- name: Remove credentials file
if: success() || failure()
run: |
cd khelo
rm functions/google-application-credentials.json
rm google-application-credentials.json
5 changes: 4 additions & 1 deletion .github/workflows/ios_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ jobs:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json

echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart
- name: Install Dependencies
run: |
cd data && flutter clean && flutter pub get
Expand Down
4 changes: 4 additions & 0 deletions data/.flutter-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ firebase_messaging_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_messa
firebase_storage=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.3.7/
firebase_storage_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage_web-3.10.6/
flutter_timezone=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-3.0.1/
google_sign_in=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/google_sign_in-6.2.2/
google_sign_in_android=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.34/
google_sign_in_ios=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.8/
google_sign_in_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.4+3/
package_info_plus=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.1.2/
path_provider_linux=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
path_provider_windows=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/
Expand Down
2 changes: 1 addition & 1 deletion data/.flutter-plugins-dependencies

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ migrate_working_dir/
**/doc/api/
.dart_tool/
build/
lib/utils/api_keys.dart
85 changes: 85 additions & 0 deletions data/lib/api/live_stream/live_stream_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// ignore_for_file: non_constant_identifier_names

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../converter/timestamp_json_converter.dart';

part 'live_stream_model.freezed.dart';

part 'live_stream_model.g.dart';

@freezed
class LiveStreamModel with _$LiveStreamModel {
const factory LiveStreamModel({
required String id,
required String match_id,
required String rtmp_url,
required String stream_id,
required String server_url,
required String stream_name,
required String broadcast_id,
required String title,
@TimeStampJsonConverter() DateTime? start_time,
@Default(LiveStreamStatus.pending) LiveStreamStatus status,
}) = _LiveStreamModel;

factory LiveStreamModel.fromJson(Map<String, dynamic> json) =>
_$LiveStreamModelFromJson(json);

factory LiveStreamModel.fromFireStore(
DocumentSnapshot<Map<String, dynamic>> snapshot,
SnapshotOptions? options,
) =>
LiveStreamModel.fromJson(snapshot.data()!);
}

enum LiveStreamStatus {
pending,
live,
paused,
completed;
}

enum MediumOption {
kheloYTChannel,
userYTChannel;

bool get isLoginRequired => this == MediumOption.userYTChannel;
}

@freezed
class YTChannel with _$YTChannel {
const factory YTChannel({
required String id,
required String title,
required String description,
required bool madeForKids,
required bool selfDeclaredMadeForKids,
required String? thumbnailUrl,
required PrivacyStatus privacyStatus,
}) = _YTChannel;

factory YTChannel.fromJson(Map<String, dynamic> json) {
return YTChannel(
id: json['id'],
title: json['snippet']['title'],
description: json['snippet']['description'],
madeForKids: json['status']['madeForKids'] ?? false,
selfDeclaredMadeForKids:
json['status']['selfDeclaredMadeForKids'] ?? false,
thumbnailUrl: json['snippet']['thumbnails']['default']['url'],
privacyStatus: json['status']['privacyStatus'] == 'public'
? PrivacyStatus.public
: json['status']['privacyStatus'] == 'private'
? PrivacyStatus.private
: PrivacyStatus.unlisted,
);
}
}

enum PrivacyStatus {
public,
private,
unlisted,
}
Loading