# PreviewSeekBar **Repository Path**: QY_windrises/PreviewSeekBar ## Basic Information - **Project Name**: PreviewSeekBar - **Description**: A SeekBar suited for showing a preview of something. As seen in Google Play Movies. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-03-30 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PreviewSeekBar A SeekBar suited for showing a preview of something. As seen in Google Play Movies. ### Google Play Movies ### PreviewSeekBar's sample ## Build Add the following to your app's build.gradle: ```groovy dependencies { // Base implementation with a standard SeekBar implementation 'com.github.rubensousa:previewseekbar:2.0.0' // ExoPlayer extension that contains a TimeBar. implementation 'com.github.rubensousa:previewseekbar-exoplayer:2.8.1.0' } ``` If you're going to use this with ExoPlayer, you need both dependencies. ## How to use #### Add the following XML: ```xml ``` #### Create a PreviewLoader and pass it to PreviewSeekBarLayout: ```java // Create a class that implements this interface and implement your own preview logic there public interface PreviewLoader { void loadPreview(long currentPosition, long max); } PreviewLoader loader = new ExoPlayerLoader(); previewSeekBarLayout.setup(loader); ``` ## How to use with ExoPlayer #### Add a custom controller to your SimpleExoPlayerView ```xml ``` Here's the sample's exoplayer_controls: https://github.com/rubensousa/PreviewSeekBar/blob/master/sample/src/main/res/layout/exoplayer_controls.xml The PreviewSeekBarLayout inside exoplayer_controls should be similar to this: ```xml ``` #### Create your own ExoPlayerLoader that seeks the video to the current position In this sample, Glide is used with a custom transformation to crop the thumbnails from a thumbnail sprite. [GlideThumbnailTransformation](https://github.com/rubensousa/PreviewSeekBar/blob/master/sample/src/main/java/com/github/rubensousa/previewseekbar/sample/glide/GlideThumbnailTransformation.java) ```java @Override public void loadPreview(long currentPosition, long max) { player.setPlayWhenReady(false); GlideApp.with(imageView) .load(thumbnailsUrl) .override(GlideThumbnailTransformation.IMAGE_WIDTH, GlideThumbnailTransformation.IMAGE_HEIGHT) .transform(new GlideThumbnailTransformation(currentPosition)) .into(imageView); } ``` ## License Copyright 2017 The Android Open Source Project Copyright 2017 RĂºben Sousa Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.