Integrate External Player
To extend NativeWaves' playback capabilities, our SDK allows seamless integration of an external Player instance. This flexibility lets you customize the playback experience to meet your specific needs while leveraging ExoPlayer's powerful features. Recognizing that every application has unique video and audio playback requirements, we provide two approaches for external player integration, giving you the freedom to use your preferred player.
- Integrating ExoPlayer (Deprecated)
- Integrating NwPlayer (Recommended)
Below, we provide a high-level overview of both approaches to help you choose the best solution for your needs.
If you choose to inject an ExoPlayer instance into the SDK, you will need to initialize it with the exoplayer configuration (or optionally use our Pre-Configured Setup). Once the ExoPlayer instance is created and injected, the SDK takes full control of the player. This means:
- Limited Freedom: You do not have the ability to customize or control the player after injection.
- Pre-Configured Setup (Optional): The ExoPlayer must be initialized with our predefined settings, leaving little room for customization.
While this approach is straightforward, it is deprecated, and we recommend migrating to the more flexible NwPlayer integration for greater control and customization.
Starting from SDK version 4.10.0, we introduced NwPlayer, an interface that allows you to wrap your preferred player (e.g., ExoPlayer or any other player) and inject it into the SDK. This approach is the latest and recommended solution for external player integration. Here is what you need to know:
- Full Control and Customization: You have complete freedom to customize the player and its behavior. You can use ExoPlayer or any other player that fits your requirements.
- Player Lifecycle Management: Unlike the ExoPlayer injection approach, you are responsible for handling the player’s lifecycle. The SDK will call methods like prepare, resume, pause, seekTo, and release through the NwPlayer interface. You must ensure that your player responds correctly to these calls to avoid playback issues.
Since you have full control, you need to carefully manage the player’s state and ensure it aligns with the SDK’s expectations.
This approach is ideal if you need advanced customization or want to use a player other than ExoPlayer.
If you are starting a new integration, we strongly recommend using NwPlayer. It provides greater flexibility and is the future-proof solution for external player integration.
If you are currently using the ExoPlayer injection approach, consider migrating to NwPlayer to take advantage of its enhanced capabilities and customization options. For detailed implementation steps, refer to the following sections:
At NativeWaves AG, we are committed to providing you with the tools and flexibility you need to deliver exceptional playback experiences. If you have any questions or need assistance, feel free to reach out to our support team. Happy coding!