Upgrade from 5.8.x to 5.9.0
This document outlines the breaking changes introduced in the Diva Player Android 5.9.0 release. These modifications necessitate developers to update their code to ensure compatibility with the new SDK version. The changes encompass class renaming, updates to function signatures, and a significant internal overhaul of the media player component.
These updates are essential for those upgrading from version 5.8.x.Diva Player Mobile​
Packages Integration Affected​
Package: com.deltatre.diva.diva-mobile-divaboadapter
Package: com.deltatre.diva.divaplayermobile
Locking the Player in Landscape Mode​
To lock the player in landscape mode, you can use the OrientationLocker utility. Here is how you can do it:
Call the enableLandscapeLock method: Use the OrientationLocker.enableLandscapeLock(this) method to lock the orientation to landscape. This method should be called in the appropriate lifecycle method of your activity or fragment.
Example Usage in an Activity:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Lock the orientation to landscape
OrientationLocker.landscapeLock(this)
}
Example Usage in a Fragment:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Lock the orientation to landscape
OrientationLocker.landscapeLock(requireActivity())
}
By following these steps, you can ensure that the player remains in landscape mode during its usage.
Diva Player TV​
Package Integration Affected:​
Package: com.deltatre.diva.divaplayertv
1. Overview of Changes​
Aspect | 5.8.x | 5.9.0 |
---|---|---|
ViewModel Initialization | DivaPlaybackViewModel initialized with ViewModelProvider | ViewModel is managed internally by DivaFragment |
Fragment Class | PlaybackVideoFragment | DivaFragment |
Fragment Configuration | Fragment created using PlaybackVideoFragment.newInstance() | Fragment created using DivaFragment.newInstance() |
Configuration Handling | Configuration passed to DivaPlaybackViewModel.load() | Configuration passed directly to DivaFragment |
2. Breaking Changes​
2.1 Removal of DivaPlaybackViewModel​
5.8.x:
divaPlaybackViewModel = ViewModelProvider(this)[DivaPlaybackViewModel::class.java]
divaPlaybackViewModel.init(setting!!, dictionary!!, videoMetadataProvider)
5.9.0:
The ViewModel DivaPlaybackViewModel
has been removed. Configuration and initialization are now handled directly through the DivaConfiguration
object and managed internally by the DivaFragment
.
- The ViewModel is no longer accessible externally.
- All configurations, functions, and APIs previously available through the ViewModel are now exposed and managed exclusively via the
DivaFragment
, which acts as the single entry point for the SDK.
Impact:
- Developers must transition from directly accessing the ViewModel to interacting with the
DivaFragment
for all player-related operations. - Lifecycle-related operations, data loading, and event handling should now be performed through
DivaFragment
.
2.2 Fragment Class Change​
5.8.x:
val playbackFragment = PlaybackVideoFragment.newInstance(applicationContext, divaListener)
5.9.0:
val fragment = DivaFragment.newInstance(conf)
Impact:
PlaybackVideoFragment
is replaced byDivaFragment
.- The configuration is now passed directly to the fragment during initialization.
- The fragment acts as the single interface for handling playback, events, and configuration.
2.3 Configuration with DivaConfiguration​
5.8.x:
val conf = DivaConfiguration(
context = this,
videoId = "{VideoID}",
setting = setting,
dictionary = dictionary
)
divaPlaybackViewModel.load(conf)
5.9.0:
val conf = DivaConfiguration(
context = this,
videoId = "{VideoID}",
videoMetadataProvider = videoMetadataProvider,
setting = setting,
dictionary = dictionary
)
Impact:
- Configuration is now fully handled through the
DivaFragment
. divaPlaybackViewModel.load(conf)
is no longer necessary, as the fragment internally manages the configuration.
3. Migration Steps​
- Remove
DivaPlaybackViewModel
and its associated initialization and loading logic. - Replace
PlaybackVideoFragment
withDivaFragment
and useDivaConfiguration
for initialization. - Pass
videoMetadataProvider
as part ofDivaConfiguration
directly to the fragment. - Update any logic that depends on direct access to the ViewModel to interact with
DivaFragment
for playback control, events, and lifecycle management.