Quick Start
Import P2pEngine
We recommend calling P2pEngine.initEngine in the instance of the Application class right after the application is created
import com.p2p.sdk.P2pEngine;Initialize P2pEngine
public class MyApplication extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
P2pEngine.init(this, YOUR_TOKEN, null);
}
}YOUR_TOKEN is your Customer ID
Playback
When initializing a media player (or any other video player, ExoPlayer is highly recommended) instance, before passing it a URL, pass that URL through P2P Engine
private void onPlay(){
String parsedUrl = P2pEngine.getInstance().parseStreamUrl("https://link_stream");
mediaPlayer.play(parsedUrl);
}File Download
Pass the file url to start the download, and then get the file path through the callback function after the download is completed.
Resolve OOM Issue in Android set-top box
You can resolve OOM by increasing heap size, add the attribute below in app/src/main/AndroidManifest.xml:
Last updated
Was this helpful?