{"id":13848141,"url":"https://github.com/linsea/UniversalVideoView","last_synced_at":"2025-07-12T11:33:25.146Z","repository":{"id":2504822,"uuid":"42507564","full_name":"linsea/UniversalVideoView","owner":"linsea","description":"A better Android VideoView with more Media Controller customization. 一个更好用的Android VideoView","archived":false,"fork":false,"pushed_at":"2022-02-24T07:10:53.000Z","size":463,"stargazers_count":992,"open_issues_count":39,"forks_count":272,"subscribers_count":57,"default_branch":"master","last_synced_at":"2024-11-21T23:31:24.335Z","etag":null,"topics":["auto-switching","fullscreen","media","media-player","mediaplayer","player","universalvideoview","video","videoview"],"latest_commit_sha":null,"homepage":"https://github.com/linsea/UniversalVideoView","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linsea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-15T09:14:27.000Z","updated_at":"2024-10-24T14:52:24.000Z","dependencies_parsed_at":"2022-08-06T12:15:30.527Z","dependency_job_id":null,"html_url":"https://github.com/linsea/UniversalVideoView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/linsea/UniversalVideoView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsea%2FUniversalVideoView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsea%2FUniversalVideoView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsea%2FUniversalVideoView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsea%2FUniversalVideoView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linsea","download_url":"https://codeload.github.com/linsea/UniversalVideoView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsea%2FUniversalVideoView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264980896,"owners_count":23692766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-switching","fullscreen","media","media-player","mediaplayer","player","universalvideoview","video","videoview"],"created_at":"2024-08-04T19:00:42.929Z","updated_at":"2025-07-12T11:33:24.561Z","avatar_url":"https://github.com/linsea.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# Android UniversalVideoView\n\n[中文版说明请点击这里](http://my.oschina.net/u/1403288/blog/522278)\n\nUniversalVideoView is a Android widget helps playing video easier, which is similar with the Android system native `VideoView`,\nbut providing more customization feature: fitXY  or keeping aspect ratio fullscreen videoView, auto switch to fullscreen on landscape mode, customised control UI...\n\n![Sample Screenshot 1](./screenshot/screen1.png)\n![Sample Screenshot 2](./screenshot/screen2.png)\n\n# Usage\n\n*For a working implementation of this project see the sample app.*\n\n  1. add library dependency to your `build.gradle` file.\n```groovy\n            dependencies {\n                compile 'com.linsea:universalvideoview:1.1.0@aar'\n            }\n```\n  2. Include the `UniversalVideoView` and  `UniversalMediaController` widget in your layout. This should usually be placed\n     in the same parent `ViewGroup`, which makes sense when in full screen state.\n```xml\n            \u003cFrameLayout\n                android:id=\"@+id/video_layout\"\n                android:layout_width=\"fill_parent\"\n                android:layout_height=\"200dp\"\n                android:background=\"@android:color/black\"\u003e\n\n                \u003ccom.universalvideoview.UniversalVideoView\n                    android:id=\"@+id/videoView\"\n                    android:layout_width=\"fill_parent\"\n                    android:layout_height=\"fill_parent\"\n                    android:layout_gravity=\"center\"\n                    app:uvv_autoRotation=\"true\"\n                    app:uvv_fitXY=\"false\" /\u003e\n\n                \u003ccom.universalvideoview.UniversalMediaController\n                    android:id=\"@+id/media_controller\"\n                    android:layout_width=\"fill_parent\"\n                    android:layout_height=\"fill_parent\"\n                    app:uvv_scalable=\"true\" /\u003e\n\n            \u003c/FrameLayout\u003e\n```\n\n  3. In your `onCreate` method, set the `UniversalMediaController` to the `UniversalVideoView` and implements the `UniversalVideoView.VideoViewCallback` Callback.\n```java\n            View mBottomLayout;\n            View mVideoLayout;\n            UniversalVideoView mVideoView;\n            UniversalMediaController mMediaController;\n\n            mVideoView = (UniversalVideoView) findViewById(R.id.videoView);\n            mMediaController = (UniversalMediaController) findViewById(R.id.media_controller);\n            mVideoView.setMediaController(mMediaController);\n\n            mVideoView.setVideoViewCallback(new UniversalVideoView.VideoViewCallback() {\n                @Override\n                public void onScaleChange(boolean isFullscreen) {\n                    this.isFullscreen = isFullscreen;\n                    if (isFullscreen) {\n                        ViewGroup.LayoutParams layoutParams = mVideoLayout.getLayoutParams();\n                        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;\n                        layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;\n                        mVideoLayout.setLayoutParams(layoutParams);\n                        //GONE the unconcerned views to leave room for video and controller\n                        mBottomLayout.setVisibility(View.GONE);\n                    } else {\n                        ViewGroup.LayoutParams layoutParams = mVideoLayout.getLayoutParams();\n                        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;\n                        layoutParams.height = this.cachedHeight;\n                        mVideoLayout.setLayoutParams(layoutParams);\n                        mBottomLayout.setVisibility(View.VISIBLE);\n                    }\n                }\n\n                @Override\n                public void onPause(MediaPlayer mediaPlayer) { // Video pause\n                    Log.d(TAG, \"onPause UniversalVideoView callback\");\n                }\n\n                @Override\n                public void onStart(MediaPlayer mediaPlayer) { // Video start/resume to play\n                    Log.d(TAG, \"onStart UniversalVideoView callback\");\n                }\n\n                @Override\n                public void onBufferingStart(MediaPlayer mediaPlayer) {// steam start loading\n                    Log.d(TAG, \"onBufferingStart UniversalVideoView callback\");\n                }\n\n                @Override\n                public void onBufferingEnd(MediaPlayer mediaPlayer) {// steam end loading\n                    Log.d(TAG, \"onBufferingEnd UniversalVideoView callback\");\n                }\n\n            });\n```\n\n## Note\n\n  * Support Android Gingerbread V2.3(API Level 9 and above).\n  * UniversalVideoView does not retain its full state when going into the background.\n    You should save or restore the state and take care of the [Activity Lifecycle](http://developer.android.com/intl/ko/guide/components/activities.html#Lifecycle).\n  * You may need to set the `android:configChanges=\"orientation|keyboardHidden|screenSize\"` for your `Activity` in `AndroidManifest.xml`\n    to prevent the system from recreate the Activity while phone rotation.\n\n# Customization\n## `UniversalVideoView` attribute\n\n * `uvv_fitXY`, Video scale to fill the VideoView's dimension or keep Aspect Ratio (default) likes Android framework VideoView.\n * `uvv_autoRotation`, auto switch to landscape(fullscreen) or portrait mode according to the orientation sensor.\n \n## `UniversalMediaController` attribute\n * `uvv_scalable`, show or hide the scale button. if you will not play the video in fullscreen.\n\n# TODO\n * Brightness control on `UniversalMediaController`.\n * Volume Control on `UniversalMediaController`.\n\n# License\n\n    Copyright 2015 The UniversalVideoView author \u003cdictfb@gmail.com\u003e\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsea%2FUniversalVideoView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinsea%2FUniversalVideoView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsea%2FUniversalVideoView/lists"}