A. Adjust your device's sleep settings to prevent it from going into sleep mode while streaming. Go to Settings > Display > Sleep and set it to a longer duration or 'Never' while streaming.
B. Keep the device plugged into a power source while streaming to prevent it from shutting off due to low battery.