normalizeCandidateString static method
Normalizes the candidate string by ensuring proper prefix. Handles different formats that might be received from the server.
candidateString The original candidate string
Returns the normalized candidate string with proper "candidate:" prefix
Implementation
static String normalizeCandidateString(String candidateString) {
if (candidateString.startsWith('a=candidate:')) {
// Only strip "a=" not "a=candidate:"
final normalized = candidateString.substring(2); // Remove "a="
GlobalLogger().i('Stripped \'a=\' prefix from candidate string');
return normalized;
} else if (!candidateString.startsWith('candidate:')) {
// If it doesn't start with "candidate:", add it
final normalized = 'candidate:$candidateString';
GlobalLogger().i('Added \'candidate:\' prefix to candidate string');
return normalized;
} else {
return candidateString;
}
}