Search in sources :

Example 6 with PlayerView

use of androidx.media3.ui.PlayerView in project edx-app-android by openedx.

the class PlayerFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    logger.debug("Player fragment start");
    try {
        final PlayerView playerView = (PlayerView) getView().findViewById(R.id.player_view);
        if (player != null) {
            player.setPlayerView(playerView);
            // setup the flat if player is fullscreen
            player.setFullScreen(isScreenLandscape());
        }
        if (curMessageTypes.contains(VideoNotPlayMessageType.IS_VIDEO_ONLY_ON_WEB)) {
            showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_ONLY_ON_WEB);
        }
        if (curMessageTypes.contains(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED)) {
            showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED);
        } else if (curMessageTypes.contains(VideoNotPlayMessageType.IS_NETWORK_MESSAGE_DISPLAYED)) {
            showNetworkError();
        } else if (curMessageTypes.contains(VideoNotPlayMessageType.IS_SHOWN_WIFI_SETTINGS_MESSAGE)) {
            showWifiSettingsMessage();
        }
    } catch (Exception e) {
        logger.error(e);
    }
}
Also used : PlayerView(com.google.android.exoplayer2.ui.PlayerView) ParseException(java.text.ParseException)

Example 7 with PlayerView

use of androidx.media3.ui.PlayerView in project edx-app-android by edx.

the class PlayerFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    logger.debug("Player fragment start");
    try {
        final PlayerView playerView = (PlayerView) getView().findViewById(R.id.player_view);
        if (player != null) {
            player.setPlayerView(playerView);
            // setup the flat if player is fullscreen
            player.setFullScreen(isScreenLandscape());
        }
        if (curMessageTypes.contains(VideoNotPlayMessageType.IS_VIDEO_ONLY_ON_WEB)) {
            showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_ONLY_ON_WEB);
        }
        if (curMessageTypes.contains(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED)) {
            showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED);
        } else if (curMessageTypes.contains(VideoNotPlayMessageType.IS_NETWORK_MESSAGE_DISPLAYED)) {
            showNetworkError();
        } else if (curMessageTypes.contains(VideoNotPlayMessageType.IS_SHOWN_WIFI_SETTINGS_MESSAGE)) {
            showWifiSettingsMessage();
        }
    } catch (Exception e) {
        logger.error(e);
    }
}
Also used : PlayerView(com.google.android.exoplayer2.ui.PlayerView) ParseException(java.text.ParseException)

Example 8 with PlayerView

use of androidx.media3.ui.PlayerView in project whiteboard-android by netless-io.

the class PlayActivity method setupPlayer.

// region override
protected void setupPlayer() {
    final String uuid = getIntent().getStringExtra(StartActivity.EXTRA_ROOM_UUID);
    try {
        if (mIsUsedExoPlayer) {
            // WhiteExoPlayer demo
            PlayerView playerView = findViewById(R.id.exo_video_view);
            playerView.setVisibility(View.VISIBLE);
            mWhiteMediaPlayer = new WhiteExoPlayer(this);
            ((WhiteExoPlayer) mWhiteMediaPlayer).setPlayerView(playerView);
            ((WhiteExoPlayer) mWhiteMediaPlayer).setVideoPath("https://white-pan.oss-cn-shanghai.aliyuncs.com/101/oceans.mp4");
        } else {
            // WhiteIjkPlayer demo
            IjkVideoView videoView = findViewById(R.id.ijk_video_view);
            videoView.setVisibility(View.VISIBLE);
            mWhiteMediaPlayer = new WhiteIjkPlayer(videoView);
            ((WhiteIjkPlayer) mWhiteMediaPlayer).setVideoPath("https://white-pan.oss-cn-shanghai.aliyuncs.com/101/oceans.mp4");
        }
        mPlayerSyncManager = new PlayerSyncManager(mWhiteMediaPlayer, new PlayerSyncManager.Callbacks() {

            @Override
            public void startBuffering() {
                Log.d(TAG_Native, "startBuffering: ");
            }

            @Override
            public void endBuffering() {
                Log.d(TAG_Native, "endBuffering: ");
            }
        });
        Log.d(TAG_Native, "create success");
    } catch (Throwable e) {
        Log.e(TAG_Native, "create fail");
    }
    DemoAPI.Result result = new DemoAPI.Result() {

        @Override
        public void success(String uuid, String roomToken) {
            initPlayer(uuid, roomToken);
        }

        @Override
        public void fail(String message) {
            alert("创建回放失败: ", message);
        }
    };
    if (uuid != null) {
        demoAPI.getRoomToken(uuid, result);
    } else if (demoAPI.hasDemoInfo()) {
        demoAPI.getNewRoom(result);
    } else {
        alert("无数据", "没有房间 uuid");
    }
}
Also used : WhiteIjkPlayer(com.herewhite.demo.player.ijk.WhiteIjkPlayer) WhiteExoPlayer(com.herewhite.demo.player.exo.WhiteExoPlayer) DemoAPI(com.herewhite.demo.common.DemoAPI) IjkVideoView(com.herewhite.demo.player.ijk.widget.media.IjkVideoView) PlayerView(com.google.android.exoplayer2.ui.PlayerView) PlayerSyncManager(com.herewhite.sdk.combinePlayer.PlayerSyncManager)

Example 9 with PlayerView

use of androidx.media3.ui.PlayerView in project playkit-android-ima by kaltura.

the class ExoPlayerWithAdPlayback method createAdPlayerView.

private PlayerView createAdPlayerView() {
    adVideoPlayerView = new PlayerView(getContext());
    adVideoPlayerView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    int id = 123456789;
    adVideoPlayerView.setId(id);
    adVideoPlayerView.setUseController(false);
    return adVideoPlayerView;
}
Also used : FrameLayout(android.widget.FrameLayout) PlayerView(com.kaltura.android.exoplayer2.ui.PlayerView)

Example 10 with PlayerView

use of androidx.media3.ui.PlayerView in project odysee-android by OdyseeTeam.

the class MainActivity method renderPictureInPictureMode.

private void renderPictureInPictureMode() {
    findViewById(R.id.main_activity_other_fragment).setVisibility(View.GONE);
    findViewById(R.id.fragment_container_main_activity).setVisibility(View.GONE);
    findViewById(R.id.miniplayer).setVisibility(View.GONE);
    findViewById(R.id.appbar).setVisibility(View.GONE);
    hideBottomNavigation();
    hideNotifications();
    hideActionBar();
    dismissActiveDialogs();
    View pipPlayerContainer = findViewById(R.id.pip_player_container);
    PlayerView pipPlayer = findViewById(R.id.pip_player);
    pipPlayer.setPlayer(appPlayer);
    pipPlayer.setUseController(false);
    pipPlayerContainer.setVisibility(View.VISIBLE);
    playerReassigned = true;
}
Also used : PlayerView(com.google.android.exoplayer2.ui.PlayerView) PlayerView(com.google.android.exoplayer2.ui.PlayerView) RecyclerView(androidx.recyclerview.widget.RecyclerView) ListView(android.widget.ListView) NavigationBarView(com.google.android.material.navigation.NavigationBarView) ImageView(android.widget.ImageView) View(android.view.View) WebView(android.webkit.WebView) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) TextView(android.widget.TextView)

Aggregations

PlayerView (com.google.android.exoplayer2.ui.PlayerView)24 TextView (android.widget.TextView)18 View (android.view.View)15 ImageView (android.widget.ImageView)14 RecyclerView (androidx.recyclerview.widget.RecyclerView)13 WebView (android.webkit.WebView)12 AdapterView (android.widget.AdapterView)10 NestedScrollView (androidx.core.widget.NestedScrollView)10 PhotoView (com.github.chrisbanes.photoview.PhotoView)10 SolidIconView (com.odysee.app.ui.controls.SolidIconView)10 Context (android.content.Context)6 Nullable (androidx.annotation.Nullable)5 SuppressLint (android.annotation.SuppressLint)4 FrameLayout (android.widget.FrameLayout)4 MainActivity (com.odysee.app.MainActivity)4 AttributeProviderContext (org.commonmark.renderer.html.AttributeProviderContext)4 Intent (android.content.Intent)3 Uri (android.net.Uri)3 Bundle (android.os.Bundle)3 ViewGroup (android.view.ViewGroup)3