Package com.jwplayer.pub.api
Class JWPlayerSupportFragment
java.lang.Object
Fragment
com.jwplayer.pub.api.JWPlayerSupportFragment
- All Implemented Interfaces:
EventListener
,VideoPlayerEvents.OnFullscreenListener
public class JWPlayerSupportFragment
extends Fragment
implements VideoPlayerEvents.OnFullscreenListener
This fragment is the simplest way to use a JW Player in your application.
It's a wrapper around the JWPlayerView that takes care of it's lifecycle needs and takes care of fullscreening.
Being a fragment you can add this fragment to your layout using the following code below:
<fragment
class="com.jwplayer.pub.api.JWPlayerSupportFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
It is assumed that the enclosing android.app.Activity
inherits (directly or indirectly) from
androidx.appcompat.app.AppCompatActivity
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.getPlayer
(LifecycleOwner lifecycleOwner) void
getPlayerAsync
(Context context, LifecycleOwner lifecycleOwner, JWPlayerImpl.PlayerInitializationListener listener) static JWPlayerSupportFragment
Creates a new JWPlayerFragment with a default configuration.static JWPlayerSupportFragment
newInstance
(PlayerConfig playerConfig) Creates a new JWPlayerFragment with the given configuration.void
onConfigurationChanged
(Configuration newConfig) void
onCreate
(Bundle savedInstanceState) View
onCreateView
(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) void
onFullscreen
(FullscreenEvent fullscreenEvent) Fired when the player toggles fullscreen mode.void
setFullscreenOnDeviceRotate
(boolean fullscreenOnDeviceRotate)
-
Constructor Details
-
JWPlayerSupportFragment
public JWPlayerSupportFragment()
-
-
Method Details
-
newInstance
Creates a new JWPlayerFragment with a default configuration.- Returns:
- A new JWPlayerFragment containing a default JWPlayerView.
-
newInstance
Creates a new JWPlayerFragment with the given configuration.- Parameters:
playerConfig
- the configuration to apply to the JWPlayerView.- Returns:
- A new JWPlayerFragment with the applied configuration.
-
onCreate
public void onCreate(Bundle savedInstanceState) -
onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) -
onConfigurationChanged
public void onConfigurationChanged(Configuration newConfig) -
setFullscreenOnDeviceRotate
public void setFullscreenOnDeviceRotate(boolean fullscreenOnDeviceRotate) - Parameters:
fullscreenOnDeviceRotate
- Whether device rotations should trigger fullscreen.
-
getPlayer
Deprecated. -
getPlayer
-
getPlayerAsync
public void getPlayerAsync(Context context, LifecycleOwner lifecycleOwner, JWPlayerImpl.PlayerInitializationListener listener) -
onFullscreen
Fired when the player toggles fullscreen mode. Used to hide the action bar.- Specified by:
onFullscreen
in interfaceVideoPlayerEvents.OnFullscreenListener
- Parameters:
fullscreenEvent
- The payload that accompanies the onFullscreen() event.
-