当前位置: 首页>>代码示例>>Java>>正文


Java SimpleExoPlayer.setVideoSurfaceView方法代码示例

本文整理汇总了Java中com.google.android.exoplayer2.SimpleExoPlayer.setVideoSurfaceView方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleExoPlayer.setVideoSurfaceView方法的具体用法?Java SimpleExoPlayer.setVideoSurfaceView怎么用?Java SimpleExoPlayer.setVideoSurfaceView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer2.SimpleExoPlayer的用法示例。


在下文中一共展示了SimpleExoPlayer.setVideoSurfaceView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
 * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
 * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
 * assignments are overridden.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player) {
    if (this.player == player) {
        return;
    }
    if (this.player != null) {
        this.player.setTextOutput(null);
        this.player.setVideoListener(null);
        this.player.removeListener(componentListener);
        this.player.setVideoSurface(null);
    }
    this.player = player;
    shutterView.setVisibility(VISIBLE);
    if (player != null) {
        if (surfaceView instanceof TextureView) {
            player.setVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            player.setVideoSurfaceView((SurfaceView) surfaceView);
        }
        player.setVideoListener(componentListener);
        player.addListener(componentListener);
        player.setTextOutput(componentListener);
    }
}
 
开发者ID:12d,项目名称:react-native-videoplayer,代码行数:31,代码来源:ExoPlayerView.java

示例2: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
 * Set the {@link SimpleExoPlayer} to use.
 * <p>
 * To transition a {@link SimpleExoPlayer} from targeting one view to another, it's recommended to
 * use {@link #switchTargetView(SimpleExoPlayer, SimpleExoPlayerView, SimpleExoPlayerView)} rather
 * than this method. If you do wish to use this method directly, be sure to attach the player to
 * the new view <em>before</em> calling {@code setPlayer(null)} to detach it from the old one.
 * This ordering is significantly more efficient and may allow for more seamless transitions.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player) {
    if (this.player == player) {
        return;
    }
    if (this.player != null) {
        this.player.removeListener(componentListener);
        this.player.removeTextOutput(componentListener);
        this.player.removeVideoListener(componentListener);
        if (surfaceView instanceof TextureView) {
            this.player.clearVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            this.player.clearVideoSurfaceView((SurfaceView) surfaceView);
        }
    }
    this.player = player;
    if (useController) {
        controller.setPlayer(player);
    }
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    if (player != null) {
        if (surfaceView instanceof TextureView) {
            player.setVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            player.setVideoSurfaceView((SurfaceView) surfaceView);
        }
        player.addVideoListener(componentListener);
        player.addTextOutput(componentListener);
        player.addListener(componentListener);
        maybeShowController(false);
        updateForCurrentTrackSelections();
    } else {
        hideController();
        hideArtwork();
    }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:49,代码来源:SimpleExoPlayerView.java

示例3: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
     * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
     * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
     * assignments are overridden.
     * <p>
     * @param player The {@link SimpleExoPlayer} to use.
     */
    public void setPlayer(SimpleExoPlayer player, @NonNull TubiPlaybackInterface playbackInterface) {
        setPlaybackInterface(playbackInterface);
        if (this.player == player) {
            return;
        }
        if (this.player != null) {
            this.player.removeListener(componentListener);
            this.player.clearTextOutput(componentListener);
            this.player.clearVideoListener(componentListener);
            if (surfaceView instanceof TextureView) {
                this.player.clearVideoTextureView((TextureView) surfaceView);
            } else if (surfaceView instanceof SurfaceView) {
                this.player.clearVideoSurfaceView((SurfaceView) surfaceView);
            }
        }
        this.player = player;
        if (useController) {
            controller.setPlayer(player,this, playbackInterface);
        }
        if (shutterView != null) {
            shutterView.setVisibility(VISIBLE);
        }
        if (player != null) {
            if (surfaceView instanceof TextureView) {
                player.setVideoTextureView((TextureView) surfaceView);
            } else if (surfaceView instanceof SurfaceView) {
                player.setVideoSurfaceView((SurfaceView) surfaceView);
            }
            player.setVideoListener(componentListener);
            player.setTextOutput(componentListener);
            player.addListener(componentListener);
//            maybeShowController(false);
            updateForCurrentTrackSelections();
        } else {
            hideController();
            hideArtwork();
        }
    }
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:46,代码来源:TubiExoPlayerView.java

示例4: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
private void setPlayer(SimpleExoPlayer player, boolean isFromSelf) {
    if (this.player == player && !isFromSelf) {
        return;
    }
    if (this.player != null) {
        this.player.removeListener(componentListener);
        this.player.setVideoSurface(null);
    }

    this.player = player;
    if (useController) {
        controller.setPlayer(player);
    }
    if (player != null) {
        if (surfaceView instanceof TextureView) {
            player.setVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            player.setVideoSurfaceView((SurfaceView) surfaceView);
        }
        player.setVideoListener(componentListener);
        player.addListener(componentListener);
        player.setTextOutput(componentListener);
        maybeShowController(false);
    } else {
        shutterView.setVisibility(VISIBLE);
        controller.hide();
    }
}
 
开发者ID:JarvanMo,项目名称:ExoPlayerVideoView,代码行数:29,代码来源:ExoVideoView.java

示例5: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
 * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
 * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
 * assignments are overridden.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player) {
  if (this.player == player) {
    return;
  }
  if (this.player != null) {
    this.player.setTextOutput(null);
    this.player.setVideoListener(null);
    this.player.removeListener(componentListener);
    this.player.setVideoSurface(null);
  }
  this.player = player;
  if (useController) {
    controller.setPlayer(player);
  }
  if (shutterView != null) {
    shutterView.setVisibility(VISIBLE);
  }
  if (player != null) {
    if (surfaceView instanceof TextureView) {
      player.setVideoTextureView((TextureView) surfaceView);
    } else if (surfaceView instanceof SurfaceView) {
      player.setVideoSurfaceView((SurfaceView) surfaceView);
    }
    player.setVideoListener(componentListener);
    player.addListener(componentListener);
    player.setTextOutput(componentListener);
    maybeShowController(false);
    updateForCurrentTrackSelections();
  } else {
    hideController();
    hideArtwork();
  }
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:41,代码来源:SimpleExoPlayerView.java

示例6: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
 * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
 * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
 * assignments are overridden.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player) {
  if (this.player == player) {
    return;
  }
  if (this.player != null) {
    this.player.setTextOutput(null);
    this.player.setVideoListener(null);
    this.player.removeListener(componentListener);
    this.player.setVideoSurface(null);
  }
  this.player = player;
  if (useController) {
    controller.setPlayer(player);
  }
  if (player != null) {
    if (surfaceView instanceof TextureView) {
      player.setVideoTextureView((TextureView) surfaceView);
    } else if (surfaceView instanceof SurfaceView) {
      player.setVideoSurfaceView((SurfaceView) surfaceView);
    }
    player.setVideoListener(componentListener);
    player.addListener(componentListener);
    player.setTextOutput(componentListener);
    maybeShowController(false);
  } else {
    shutterView.setVisibility(VISIBLE);
    controller.hide();
  }
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:37,代码来源:SimpleExoPlayerView.java

示例7: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
 * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
 * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
 * assignments are overridden.
 * <p>
 * To transition a {@link SimpleExoPlayer} from targeting one view to another, it's recommended to
 * use {@link #switchTargetView(SimpleExoPlayer, SimpleExoPlayerView, SimpleExoPlayerView)} rather
 * than this method. If you do wish to use this method directly, be sure to attach the player to
 * the new view <em>before</em> calling {@code setPlayer(null)} to detach it from the old one.
 * This ordering is significantly more efficient and may allow for more seamless transitions.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player) {
    if (this.player == player) {
        return;
    }
    if (this.player != null) {
        this.player.removeListener(componentListener);
        this.player.clearTextOutput(componentListener);
        this.player.clearVideoListener(componentListener);
        if (surfaceView instanceof TextureView) {
            this.player.clearVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            this.player.clearVideoSurfaceView((SurfaceView) surfaceView);
        }
    }
    this.player = player;
    if (useController) {
        controller.setPlayer(player);
    }
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    if (player != null) {
        if (surfaceView instanceof TextureView) {
            player.setVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            player.setVideoSurfaceView((SurfaceView) surfaceView);
        }
        player.setVideoListener(componentListener);
        player.setTextOutput(componentListener);
        player.addListener(componentListener);
        maybeShowController(false);
        updateForCurrentTrackSelections();
    } else {
        hideController();
        hideArtwork();
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:51,代码来源:SimpleExoPlayerView.java

示例8: setPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
 * Set the {@link SimpleExoPlayer} to use.
 * <p>
 * To transition a {@link SimpleExoPlayer} from targeting one view to another, it's recommended to
 * use {@link #switchTargetView(SimpleExoPlayer, SimpleExoPlayerView, SimpleExoPlayerView)} rather
 * than this method. If you do wish to use this method directly, be sure to attach the player to
 * the new view <em>before</em> calling {@code setPlayer(null)} to detach it from the old one.
 * This ordering is significantly more efficient and may allow for more seamless transitions.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player) {
  if (this.player == player) {
    return;
  }
  if (this.player != null) {
    this.player.removeListener(componentListener);
    this.player.removeTextOutput(componentListener);
    this.player.removeVideoListener(componentListener);
    if (surfaceView instanceof TextureView) {
      this.player.clearVideoTextureView((TextureView) surfaceView);
    } else if (surfaceView instanceof SurfaceView) {
      this.player.clearVideoSurfaceView((SurfaceView) surfaceView);
    }
  }
  this.player = player;
  if (useController) {
    controller.setPlayer(player);
  }
  if (shutterView != null) {
    shutterView.setVisibility(VISIBLE);
  }
  if (subtitleView != null) {
    subtitleView.setCues(null);
  }
  if (player != null) {
    if (surfaceView instanceof TextureView) {
      player.setVideoTextureView((TextureView) surfaceView);
    } else if (surfaceView instanceof SurfaceView) {
      player.setVideoSurfaceView((SurfaceView) surfaceView);
    }
    player.addVideoListener(componentListener);
    player.addTextOutput(componentListener);
    player.addListener(componentListener);
    maybeShowController(false);
    updateForCurrentTrackSelections();
  } else {
    hideController();
    hideArtwork();
  }
}
 
开发者ID:y20k,项目名称:transistor,代码行数:52,代码来源:SimpleExoPlayerView.java


注:本文中的com.google.android.exoplayer2.SimpleExoPlayer.setVideoSurfaceView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。