Skip to content

Commit

Permalink
fixed videoroom events causing stringid support to fail #51
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshtalwar committed Oct 21, 2022
1 parent 472a77c commit d72cd77
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_ios","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.20/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_macos","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/","native_build":false,"dependencies":[]}],"windows":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"flutter_webrtc","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2022-10-17 11:09:03.146470","version":"3.3.4"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_ios","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.20/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_macos","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/","native_build":false,"dependencies":[]}],"windows":[{"name":"flutter_webrtc","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.9.11/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/utopia/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"flutter_webrtc","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2022-10-21 13:25:32.776248","version":"3.3.4"}
10 changes: 1 addition & 9 deletions example/lib/conf.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
var servers = [
'wss://master-janus.onemandev.tech/websocket',
'wss://janus.conf.meetecho.com/ws',
'https://unified-janus.onemandev.tech/rest',
'wss://janus.conf.meetecho.com/ws',
'wss://unified-janus.onemandev.tech/websocket',
'https://unified-janus.onemandev.tech/rest'
];

Map<String, String> servermap = {
'janus_ws': 'wss://janus.conf.meetecho.com/ws',
'janus_rest': 'https://janus.conf.meetecho.com/janus',
'servercheap': 'ws://107.152.35.248/websocket',
'onemandev_master_ws': 'wss://master-janus.onemandev.tech/websocket',
'onemandev_master_rest': 'https://master-janus.onemandev.tech/rest',
'onemandev_unified_rest': 'https://unified-janus.onemandev.tech/rest',
Expand Down
20 changes: 10 additions & 10 deletions example/lib/typed_examples/video_room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TypedVideoRoomV2Unified extends StatefulWidget {

class _VideoRoomState extends State<TypedVideoRoomV2Unified> {
late JanusClient j;
Map<int, RemoteStream> remoteStreams = {};
Map<dynamic, RemoteStream> remoteStreams = {};

late RestJanusTransport rest;
late WebSocketJanusTransport ws;
Expand All @@ -22,12 +22,12 @@ class _VideoRoomState extends State<TypedVideoRoomV2Unified> {
JanusVideoRoomPlugin? remoteHandle;
late int myId;
bool front = true;
int myRoom = 1234;
Map<int, dynamic> feedStreams = {};
Map<int?, dynamic> subscriptions = {};
Map<int, dynamic> feeds = {};
Map<String, int> subStreams = {};
Map<int, MediaStream?> mediaStreams = {};
dynamic myRoom = 1234;
Map<dynamic, dynamic> feedStreams = {};
Map<dynamic, dynamic> subscriptions = {};
Map<dynamic, dynamic> feeds = {};
Map<dynamic, dynamic> subStreams = {};
Map<dynamic, MediaStream?> mediaStreams = {};

@override
void didChangeDependencies() async {
Expand All @@ -46,7 +46,7 @@ class _VideoRoomState extends State<TypedVideoRoomV2Unified> {
plugin = await session.attach<JanusVideoRoomPlugin>();
}

subscribeTo(List<Map<String, dynamic>> sources) async {
subscribeTo(List<Map<dynamic, dynamic>> sources) async {
if (sources.length == 0) return;
var streams = (sources)
.map((e) => PublisherStream(mid: e['mid'], feed: e['feed']))
Expand Down Expand Up @@ -86,7 +86,7 @@ class _VideoRoomState extends State<TypedVideoRoomV2Unified> {
remoteHandle?.remoteTrack?.listen((event) async {
String mid = event.mid!;
if (subStreams[mid] != null) {
int feedId = subStreams[mid]!;
dynamic feedId = subStreams[mid]!;
if (!remoteStreams.containsKey(feedId)) {
RemoteStream temp = RemoteStream(feedId.toString());
await temp.init();
Expand Down Expand Up @@ -120,7 +120,7 @@ class _VideoRoomState extends State<TypedVideoRoomV2Unified> {
Object data = event.event.plugindata?.data;
if (data is VideoRoomJoinedEvent) {
(await plugin.publishMedia(bitrate: 3000000));
List<Map<String, dynamic>> publisherStreams = [];
List<Map<dynamic, dynamic>> publisherStreams = [];
for (Publishers publisher in data.publishers ?? []) {
for (Streams stream in publisher.streams ?? []) {
feedStreams[publisher.id!] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class AttachedStreams extends BaseStream {
send = json['send'];
ready = json['ready'];
}
int? feedId;
String? feedMid;
dynamic feedId;
dynamic feedMid;
String? feedDisplay;
bool? send;
bool? ready;
Expand Down
25 changes: 2 additions & 23 deletions lib/interfaces/video_room/events/video_room_event.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
part of janus_client;

class VideoRoomEvent {
late String videoroom;
String? videoroom;
dynamic room;

//<editor-fold desc="Data Methods">
Expand All @@ -10,10 +10,7 @@ class VideoRoomEvent {
room = room;
}

VideoRoomEvent() {
this.videoroom = '';
room = 0;
}
VideoRoomEvent() {}

@override
bool operator ==(Object other) =>
Expand All @@ -33,31 +30,13 @@ class VideoRoomEvent {
' room: $room,' +
'}';
}

VideoRoomEvent copyWith({
String? videoroom,
int? room,
}) {
return VideoRoomEvent.create(
videoroom ?? this.videoroom,
room ?? this.room,
);
}

Map<String, dynamic> toMap() {
return {
'videoroom': this.videoroom,
'room': this.room,
};
}

factory VideoRoomEvent.fromMap(Map<String, dynamic> map) {
return VideoRoomEvent.create(
map['videoroom'] as String,
map['room'] as int,
);
}

//</editor-fold>
}

Expand Down
4 changes: 2 additions & 2 deletions lib/interfaces/video_room/events/video_room_joined_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class VideoRoomJoinedEvent extends VideoRoomEvent {
}

String? description;
int? id;
dynamic id;
int? privateId;
List<Publishers>? publishers;

Expand Down Expand Up @@ -70,7 +70,7 @@ class Publishers {
talking = json['talking'];
}

int? id;
dynamic id;
String? display;
String? audioCodec;
String? videoCodec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class VideoRoomNewPublisherEvent extends VideoRoomEvent {
class PublisherStream {
bool? simulcast;
bool? svc;
int? feed;
String? mid;
dynamic feed;
dynamic mid;

//<editor-fold desc="Data Methods">

Expand Down Expand Up @@ -73,20 +73,6 @@ class PublisherStream {
'}';
}

PublisherStream copyWith({
bool? simulcast,
bool? svc,
int? feed,
String? mid,
}) {
return PublisherStream(
simulcast: simulcast ?? this.simulcast,
svc: svc ?? this.svc,
feed: feed ?? this.feed,
mid: mid ?? this.mid,
);
}

Map<String, dynamic> toMap() {
return {
'simulcast': this.simulcast,
Expand All @@ -100,8 +86,8 @@ class PublisherStream {
return PublisherStream(
simulcast: map['simulcast'] as bool,
svc: map['svc'] as bool,
feed: map['feed'] as int,
mid: map['mid'] as String,
feed: map['feed'],
mid: map['mid'],
);
}

Expand Down

0 comments on commit d72cd77

Please sign in to comment.