com.google.android.exoplayer2.video.VideoListener Java Examples

The following examples show how to use com.google.android.exoplayer2.video.VideoListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaPlayerSingleton.java    From dtube-mobile-unofficial with Apache License 2.0 4 votes vote down vote up
private void init(Activity c) {
    embeddedPlayer = new WebViewVideoView(c,false);

    playerView = new PlayerView(c);
    player = ExoPlayerFactory.newSimpleInstance(c);
    playerView.setShowBuffering(SHOW_BUFFERING_ALWAYS);
    playerView.setPlayer(player);

    this.c = c;

    UiModeManager uiModeManager = (UiModeManager) c.getSystemService(UI_MODE_SERVICE);

    if (uiModeManager.getCurrentModeType()== Configuration.UI_MODE_TYPE_TELEVISION) {
        playerView.findViewById(R.id.exo_fullscreen_button).setVisibility(View.GONE);
        int extraPadding = Tools.numtodp(20, c);
        playerView.findViewById(R.id.control_bar_holder).setPadding(extraPadding,0,extraPadding,extraPadding);
    }

    player.addListener(new Player.EventListener() {
        @Override
        public void onLoadingChanged(boolean isLoading) {

        }

        @Override
        public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {

        }

        @Override
        public void onPlayerError(ExoPlaybackException error) {
            //hadErrorLoading = true;
            if (!videoToPlay.hasTriedLoadingBackupGateway()){
                //try loading backup stream
                Log.d("dtube3","BACKUP LOAD "+videoToPlay.getBackupVideoStreamURL());
                player.prepare(getMediaSource(videoToPlay.getBackupVideoStreamURL()));
                player.setPlayWhenReady(true);
            }else
                Toast.makeText(c, R.string.video_error, Toast.LENGTH_LONG).show();
        }
    });

    player.addVideoListener(new VideoListener() {
        @Override
        public void onRenderedFirstFrame() {
        }
    });
}
 
Example #2
Source File: ExoPlayerVideoListener.java    From no-player with Apache License 2.0 4 votes vote down vote up
public void add(VideoListener listener) {
    listeners.add(listener);
}
 
Example #3
Source File: ExoPlayerVideoListener.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
    for (VideoListener listener : listeners) {
        listener.onVideoSizeChanged(width, height, unappliedRotationDegrees, pixelWidthHeightRatio);
    }
}
 
Example #4
Source File: ExoPlayerVideoListener.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onRenderedFirstFrame() {
    for (VideoListener listener : listeners) {
        listener.onRenderedFirstFrame();
    }
}
 
Example #5
Source File: ExoPlayerForwarder.java    From no-player with Apache License 2.0 4 votes vote down vote up
public VideoListener videoListener() {
    return videoListener;
}
 
Example #6
Source File: Player.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Adds a listener to receive video events.
 *
 * @param listener The listener to register.
 */
void addVideoListener(VideoListener listener);
 
Example #7
Source File: Player.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Removes a listener of video events.
 *
 * @param listener The listener to unregister.
 */
void removeVideoListener(VideoListener listener);
 
Example #8
Source File: Player.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Adds a listener to receive video events.
 *
 * @param listener The listener to register.
 */
void addVideoListener(VideoListener listener);
 
Example #9
Source File: Player.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Removes a listener of video events.
 *
 * @param listener The listener to unregister.
 */
void removeVideoListener(VideoListener listener);
 
Example #10
Source File: Player.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Adds a listener to receive video events.
 *
 * @param listener The listener to register.
 */
void addVideoListener(VideoListener listener);
 
Example #11
Source File: Player.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Removes a listener of video events.
 *
 * @param listener The listener to unregister.
 */
void removeVideoListener(VideoListener listener);
 
Example #12
Source File: Player.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Adds a listener to receive video events.
 *
 * @param listener The listener to register.
 */
void addVideoListener(VideoListener listener);
 
Example #13
Source File: Player.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Removes a listener of video events.
 *
 * @param listener The listener to unregister.
 */
void removeVideoListener(VideoListener listener);
 
Example #14
Source File: Player.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Adds a listener to receive video events.
 *
 * @param listener The listener to register.
 */
void addVideoListener(VideoListener listener);
 
Example #15
Source File: Player.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Removes a listener of video events.
 *
 * @param listener The listener to unregister.
 */
void removeVideoListener(VideoListener listener);