ScalableVideoView


Source link: https://github.com/yqritc/Android-ScalableVideoView

Android-ScalableVideoView

Looking for the extra scale types of ImageView? Check out ScalableImageView.

Android Texture VideoView having a variety of scale types like the scale types of ImageView.

Sample

Release Note

[Release Note] ( https://github.com/yqritc/Android-ScalableVideoView/releases)

Gradle

repositories {

  jcenter() 
}
  dependencies {

  compile 'com.yqritc:android-scalablevideoview:1.0.4' 
}
 

Support Scale Types

Scale to fit

  • fitXY
  • fitStart
  • fitCenter
  • fitEnd

No Scale

  • leftTop
  • leftCenter
  • leftBottom
  • centerTop
  • center
  • centerBottom
  • rightTop
  • rightCenter
  • rightBottom

Crop

  • leftTopCrop
  • leftCenterCrop
  • leftBottomCrop
  • centerTopCrop
  • centerCrop
  • centerBottomCrop
  • rightTopCrop
  • rightCenterCrop
  • rightBottomCrop

Scale Inside

  • startInside
  • centerInside
  • endInside

Usage

Set scale type in layout file

<com.yqritc.scalablevideoview.ScalableVideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="100dp"
app:scalableType="fitCenter"/> 

Please refere the following xml for the list of scalableType you can set.
attrs.xml

Sample usage in source code

@Override protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

mVideoView = (ScalableVideoView) findViewById(R.id.video_view);

try {

  mVideoView.setRawData(R.raw.landscape_sample);

}
 catch (IOException ioe) {

  //handle error

}
 
}
  @Override public void onClick(View v) {

switch (v.getId()) {

  case R.id.btn_start:

mVideoView.start();

break;
  case R.id.btn_update_scale:

mVideoView.setScalableType(ScalableType.CENTER_TOP_CROP);

mVideoView.invalidate();

break;

 default:

break;

}
 
}
 

ScalableVideoView is extending TextureView to play video by using MediaPlayer.
Basic functionalities are defined in this class to play and scale video.
If you need to control more, extend this class and define your custom video view.

License

Copyright 2015 yqritc  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. 

Resources

Material CAB allows you to implement a customizable and flexible contextual action bar in your app. The traditional stock CAB on Android is limited to being placed at the top of your Activity, and the navigation drawer cannot go over it. This library lets you choose its exact location, and a toolbar is used allowing views to be be placed over and under it.

An Android library for pattern lock.

Localify is a small library which allows to load a content from files which are stored under assets and/or raw directory. It can be useful when you have to load some init data or during tests to load mock data.

Session is a easy to use Persistence Library which save datas into SharedPreference.

TextViewOverflowing is a custom android view that allows reflowing from one TextView to another.

Do you want to customize what you share, depending on what the user wants to share it with?

Let's say you want to add a "via @theTwitterAccountOfYourProduct" if the content is being shared with a Twitter client.

BOOM! That's what Yeti does.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes