Documentation Index
Fetch the complete documentation index at: https://learn.social.plus/llms.txt
Use this file to discover all available pages before exploring further.
Platform-Specific Troubleshooting
This guide addresses common issues specific to different platforms when using the social.plus Video SDK. Each platform has unique characteristics and potential problems that require targeted solutions.
iOS Troubleshooting
Camera and Microphone Issues
Issue: Camera Permission Denied
AVCaptureDevice authorization denied
Solution:
import AVFoundation
// Check and request camera permission
func requestCameraPermission() {
let status = AVCaptureDevice.authorizationStatus(for: .video)
switch status {
case .notDetermined:
AVCaptureDevice.requestAccess(for: .video) { granted in
if granted {
// Initialize camera
} else {
// Show permission explanation
}
}
case .denied, .restricted:
// Direct user to settings
showSettingsAlert()
case .authorized:
// Camera access granted
break
}
}
Issue: Audio Session Conflicts
Error: Audio session already in use by another app
Solution:
import AVFoundation
// Configure audio session properly
func configureAudioSession() {
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(.playAndRecord,
mode: .videoChat,
options: [.defaultToSpeaker, .allowBluetooth])
try audioSession.setActive(true)
} catch {
print("Audio session configuration failed: \(error)")
}
}
Background Streaming Issues
Issue: Stream Stops in Background
App suspended, streaming interrupted
Solution:
- Enable Background App Refresh in iOS Settings
- Configure background modes in Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>background-processing</string>
<string>background-audio</string>
<string>voip</string>
</array>
- Implement background task handling:
var backgroundTask: UIBackgroundTaskIdentifier = .invalid
func startBackgroundTask() {
backgroundTask = UIApplication.shared.beginBackgroundTask {
self.endBackgroundTask()
}
}
func endBackgroundTask() {
if backgroundTask != .invalid {
UIApplication.shared.endBackgroundTask(backgroundTask)
backgroundTask = .invalid
}
}
Memory Management Issues
Issue: Memory Warnings and Crashes
Memory pressure, app terminated
Solution:
// Optimize memory usage
func optimizeMemoryUsage() {
// Reduce video resolution in low memory situations
NotificationCenter.default.addObserver(
forName: UIApplication.didReceiveMemoryWarningNotification,
object: nil,
queue: .main
) { _ in
self.reduceBroadcastQuality()
}
}
func reduceBroadcastQuality() {
// Lower resolution and bitrate
socialPlusSDK.configureStream(
resolution: "480p",
bitrate: 1500
)
}
Android Troubleshooting
Permission Management
Issue: Runtime Permissions Not Granted
SecurityException: Permission denial
Solution:
import android.Manifest
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
class StreamActivity : AppCompatActivity() {
private val PERMISSIONS_REQUEST_CODE = 100
private fun checkPermissions(): Boolean {
val permissions = arrayOf(
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
return permissions.all { permission ->
ContextCompat.checkSelfPermission(this, permission) ==
PackageManager.PERMISSION_GRANTED
}
}
private fun requestPermissions() {
val permissions = arrayOf(
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
ActivityCompat.requestPermissions(
this,
permissions,
PERMISSIONS_REQUEST_CODE
)
}
}
Camera2 API Issues
Issue: Camera Initialization Fails
CameraAccessException: Camera service unavailable
Solution:
import android.hardware.camera2.*
class CameraManager {
private fun initializeCamera() {
val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager
try {
val cameraId = cameraManager.cameraIdList[0]
val characteristics = cameraManager.getCameraCharacteristics(cameraId)
// Check camera capabilities
val capabilities = characteristics.get(
CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES
)
if (capabilities?.contains(
CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE
) == true) {
// Camera supports required features
openCamera(cameraId)
} else {
// Fallback to Camera API
useLegacyCameraAPI()
}
} catch (e: CameraAccessException) {
handleCameraError(e)
}
}
}
Network Configuration Issues
Issue: Network Security Policy Blocks Connections
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
Solution:
- Configure network security in
res/xml/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">your-streaming-domain.com</domain>
</domain-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
</network-security-config>
- Reference in AndroidManifest.xml:
<application
android:networkSecurityConfig="@xml/network_security_config">
</application>
Background Service Issues
Issue: Service Killed by System
Service destroyed due to memory pressure
Solution:
class StreamingService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
createNotificationChannel()
startForeground(NOTIFICATION_ID, createNotification())
// Return sticky to restart service if killed
return START_STICKY
}
private fun createNotification(): Notification {
return NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("Live Streaming")
.setContentText("Stream is active")
.setSmallIcon(R.drawable.ic_stream)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.build()
}
}
Web Browser Troubleshooting
WebRTC Issues
Issue: WebRTC Not Supported
Navigator.mediaDevices is undefined
Solution:
// Check WebRTC support and provide fallbacks
function checkWebRTCSupport() {
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
console.warn('WebRTC not supported');
// Fallback to older API
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia;
if (!navigator.getUserMedia) {
// Use HLS fallback
return useHLSFallback();
}
}
return true;
}
function useHLSFallback() {
// Configure HLS player
const player = new SocialPlusVideo({
apiKey: 'your-api-key',
playbackProtocol: 'hls',
fallbackEnabled: true
});
return player;
}
HTTPS Requirements
getUserMedia() no longer works on insecure origins
Solution:
- Use HTTPS in production
- For development, use localhost or configure browser flags
- Alternative for testing:
// Development workaround
if (location.protocol !== 'https:' && location.hostname !== 'localhost') {
console.warn('HTTPS required for camera access');
// Redirect to HTTPS or show warning
if (confirm('Camera access requires HTTPS. Redirect?')) {
location.href = 'https://' + location.host + location.pathname;
}
}
Cross-Origin Issues
Issue: CORS Blocking Requests
Access to fetch blocked by CORS policy
Solution:
// Configure CORS headers on your server
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', 'https://yourdomain.com');
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
next();
});
// Or use proxy in development
const sdk = new SocialPlusVideo({
apiKey: 'your-api-key',
proxyUrl: '/api/proxy', // Your proxy endpoint
useCORS: true
});
Browser-Specific Issues
Safari Issues
// Safari-specific fixes
if (navigator.userAgent.indexOf('Safari') > -1 &&
navigator.userAgent.indexOf('Chrome') === -1) {
// Safari requires user interaction for autoplay
sdk.configurePlayback({
autoplay: false,
muted: true, // Muted autoplay is allowed
playsInline: true // Prevent fullscreen on iOS
});
}
Firefox Issues
// Firefox WebRTC compatibility
if (navigator.userAgent.indexOf('Firefox') > -1) {
sdk.configureWebRTC({
iceServers: [
{ urls: 'stun:stun.mozilla.org' }
],
sdpSemantics: 'plan-b' // Firefox uses plan-b
});
}
React Native Troubleshooting
Metro Bundler Issues
Issue: Module Resolution Fails
Unable to resolve module @social-plus/video-sdk
Solution:
- Clear Metro cache:
npx react-native start --reset-cache
- Configure Metro bundler in
metro.config.js:
module.exports = {
resolver: {
alias: {
'@social-plus/video-sdk': require.resolve('@social-plus/video-sdk')
}
}
};
Native Module Linking Issues
Issue: Native Modules Not Found
NativeModules.SocialPlusVideo is undefined
Solution:
- For React Native >= 0.60 (auto-linking):
- For older versions:
react-native link @social-plus/video-sdk
- Manual linking if needed:
// android/settings.gradle
include ':social-plus-video-sdk'
project(':social-plus-video-sdk').projectDir =
new File(rootProject.projectDir, '../node_modules/@social-plus/video-sdk/android')
// android/app/build.gradle
dependencies {
implementation project(':social-plus-video-sdk')
}
// Use Platform module properly
import { Platform } from 'react-native';
const StreamComponent = () => {
const configureSDK = () => {
const config = {
apiKey: 'your-api-key',
...Platform.select({
ios: {
audioSession: 'videoChat',
backgroundModes: ['audio']
},
android: {
foregroundService: true,
notificationConfig: {
channelId: 'streaming',
title: 'Live Stream'
}
}
})
};
return new SocialPlusVideo(config);
};
};
Flutter Troubleshooting
Plugin Registration Issues
Issue: Plugin Not Registered
MissingPluginException: No implementation found for method
Solution:
- Run
flutter clean and flutter pub get
- For iOS, run
cd ios && pod install
- Ensure plugin is properly registered:
// In your main.dart
import 'package:social_plus_video/social_plus_video.dart';
void main() {
// Ensure plugin is initialized
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
// Implement proper error handling
try {
final result = await SocialPlusVideo.initialize(apiKey: 'your-key');
} on PlatformException catch (e) {
print('Platform error: ${e.code} - ${e.message}');
// Handle specific error codes
switch (e.code) {
case 'PERMISSION_DENIED':
requestPermissions();
break;
case 'NETWORK_ERROR':
checkNetworkConnection();
break;
default:
showGenericError();
}
}
class StreamWidget extends StatefulWidget {
@override
_StreamWidgetState createState() => _StreamWidgetState();
}
class _StreamWidgetState extends State<StreamWidget> {
late SocialPlusVideoController _controller;
@override
void initState() {
super.initState();
_initializeController();
}
Future<void> _initializeController() async {
try {
_controller = await SocialPlusVideo.createController();
// Check if widget is still mounted
if (mounted) {
setState(() {
// Update UI
});
}
} catch (e) {
if (mounted) {
// Handle error
}
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}
Universal Troubleshooting Tips
Debug Mode Setup
// Enable comprehensive debugging across all platforms
const sdk = new SocialPlusVideo({
apiKey: 'your-api-key',
debug: {
enabled: true,
level: 'verbose',
logToConsole: true,
logToFile: true,
remoteLogging: true
}
});
// Platform-specific debug info
const debugInfo = await sdk.getPlatformDebugInfo();
console.log('Platform debug info:', debugInfo);
// Monitor performance across platforms
sdk.on('performanceUpdate', (metrics) => {
console.log('Performance metrics:', {
platform: metrics.platform,
fps: metrics.fps,
bitrate: metrics.bitrate,
latency: metrics.latency,
memoryUsage: metrics.memoryUsage,
cpuUsage: metrics.cpuUsage
});
// Alert on performance issues
if (metrics.fps < 15 || metrics.latency > 500) {
console.warn('Performance degradation detected');
optimizeSettings();
}
});
Next Steps
For platform-specific issues:
- iOS: Check Xcode console for detailed error messages
- Android: Use Android Studio’s Logcat for debugging
- Web: Use browser developer tools and console
- React Native: Use React Native debugger and platform logs
- Flutter: Use Flutter inspector and platform channels debugging
Include platform-specific debug information when reporting issues to get faster resolution.