Skip to content

Commit 706f38d

Browse files
authored
Merge pull request #11 from Novage/docs/improvements
Docs: improve docs
2 parents e937f93 + 14b0df8 commit 706f38d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ Make sure to reference this file in the `<application>` tag of your **`AndroidMa
7878

7979
## Usage
8080

81+
#### ⚠️ P2P (WebRTC) may not connect to the outer world if it runs on Android emulators due to its virtual machine [network configuration](https://developer.android.com/studio/run/emulator-networking) (NAT). Please test P2P connectivity on real devices. ⚠️
82+
8183
Once you've completed the setup, P2P Media Loader is ready to use in your application!
8284

8385
### Kotlin Example
@@ -89,6 +91,7 @@ class MainActivity : ComponentActivity() {
8991
private const val MANIFEST_URL = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"
9092

9193
// JSON configuration for P2P Media Loader
94+
// See https://novage.github.io/p2p-media-loader/docs/v2.1.0/types/p2p_media_loader_core.CoreConfig.html
9295
private const val CORE_CONFIG_JSON = "{\"swarmId\":\"TEST_KOTLIN\"}"
9396

9497
// Port on which the P2P server will run
@@ -181,12 +184,14 @@ class MainActivity : ComponentActivity() {
181184
override fun onStop() {
182185
super.onStop()
183186
// Disable P2P features when the activity stops
187+
// See https://novage.github.io/p2p-media-loader/docs/v2.1.0/types/p2p_media_loader_core.DynamicCoreConfig.html
184188
p2pml.applyDynamicConfig("{\"isP2PDisabled\": true}")
185189
}
186190

187191
override fun onRestart() {
188192
super.onRestart()
189193
// Re-enable P2P features when the activity restarts
194+
// See https://novage.github.io/p2p-media-loader/docs/v2.1.0/types/p2p_media_loader_core.DynamicCoreConfig.html
190195
p2pml.applyDynamicConfig("{\"isP2PDisabled\": false}")
191196
}
192197

@@ -210,6 +215,7 @@ public class MainActivity extends AppCompatActivity {
210215
private static final int SERVER_PORT = 8081;
211216

212217
// JSON configuration for P2P Media Loader
218+
// See https://novage.github.io/p2p-media-loader/docs/v2.1.0/types/p2p_media_loader_core.CoreConfig.html
213219
private static final String CORE_CONFIG_JSON = "{\"swarmId\":\"TEST_KOTLIN\"}";
214220

215221
private ExoPlayer exoPlayer;
@@ -317,6 +323,7 @@ public class MainActivity extends AppCompatActivity {
317323
super.onRestart();
318324
// Disable P2P features when the activity stops
319325
if (p2pml != null) {
326+
// See https://novage.github.io/p2p-media-loader/docs/v2.1.0/types/p2p_media_loader_core.DynamicCoreConfig.html
320327
p2pml.applyDynamicConfig("{ \"isP2PDisabled\": false }");
321328
}
322329
}
@@ -326,6 +333,7 @@ public class MainActivity extends AppCompatActivity {
326333
super.onStop();
327334
// Re-enable P2P features when the activity restarts
328335
if (p2pml != null) {
336+
// See https://novage.github.io/p2p-media-loader/docs/v2.1.0/types/p2p_media_loader_core.DynamicCoreConfig.html
329337
p2pml.applyDynamicConfig("{ \"isP2PDisabled\": true }");
330338
}
331339
}

0 commit comments

Comments
 (0)