Skip to content

Commit

Permalink
live stream
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sidhdhi-p committed Jan 15, 2025
1 parent af0c815 commit 0eb8f92
Show file tree
Hide file tree
Showing 63 changed files with 3,408 additions and 125 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/function_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ jobs:
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_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
- 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
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
84 changes: 84 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,84 @@
// 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

0 comments on commit 0eb8f92

Please sign in to comment.