Skip to content

Commit

Permalink
Change trackLookUp parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Dec 12, 2024
1 parent 3c89ca9 commit 8aae0d7
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ extension RTCMediaStream {

/// Determines the type of track based on the stream's identifier.
var trackType: TrackType {
if streamId.hasSuffix(screenShareTrackType) {
let components = streamId.components(separatedBy: ":")
guard
components.endIndex > 1
else {
return .unknown
}
let component = components[1]

switch component {
case screenShareTrackType:
return .screenshare
} else if streamId.hasSuffix(videoTrackType) {
case videoTrackType:
return .video
} else if streamId.hasSuffix(audioTrackType) {
case audioTrackType:
return .audio
} else {
default:
return .unknown
}
}
Expand Down

0 comments on commit 8aae0d7

Please sign in to comment.