在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:UniversalVideoView开源软件地址:https://gitee.com/dictfb/UniversalVideoView开源软件介绍:Android UniversalVideoViewUniversalVideoView is a Android widget helps playing video easier, which is similar with the Android system native UsageFor a working implementation of this project see the sample app.
dependencies { compile 'com.linsea:universalvideoview:1.1.0@aar' }
<FrameLayout android:id="@+id/video_layout" android:layout_width="fill_parent" android:layout_height="200dp" android:background="@android:color/black"> <com.universalvideoview.UniversalVideoView android:id="@+id/videoView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" app:uvv_autoRotation="true" app:uvv_fitXY="false" /> <com.universalvideoview.UniversalMediaController android:id="@+id/media_controller" android:layout_width="fill_parent" android:layout_height="fill_parent" app:uvv_scalable="true" /> </FrameLayout>
View mBottomLayout; View mVideoLayout; UniversalVideoView mVideoView; UniversalMediaController mMediaController; mVideoView = (UniversalVideoView) findViewById(R.id.videoView); mMediaController = (UniversalMediaController) findViewById(R.id.media_controller); mVideoView.setMediaController(mMediaController); mVideoView.setVideoViewCallback(new UniversalVideoView.VideoViewCallback() { @Override public void onScaleChange(boolean isFullscreen) { this.isFullscreen = isFullscreen; if (isFullscreen) { ViewGroup.LayoutParams layoutParams = mVideoLayout.getLayoutParams(); layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; mVideoLayout.setLayoutParams(layoutParams); //GONE the unconcerned views to leave room for video and controller mBottomLayout.setVisibility(View.GONE); } else { ViewGroup.LayoutParams layoutParams = mVideoLayout.getLayoutParams(); layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.height = this.cachedHeight; mVideoLayout.setLayoutParams(layoutParams); mBottomLayout.setVisibility(View.VISIBLE); } } @Override public void onPause(MediaPlayer mediaPlayer) { // Video pause Log.d(TAG, "onPause UniversalVideoView callback"); } @Override public void onStart(MediaPlayer mediaPlayer) { // Video start/resume to play Log.d(TAG, "onStart UniversalVideoView callback"); } @Override public void onBufferingStart(MediaPlayer mediaPlayer) {// steam start loading Log.d(TAG, "onBufferingStart UniversalVideoView callback"); } @Override public void onBufferingEnd(MediaPlayer mediaPlayer) {// steam end loading Log.d(TAG, "onBufferingEnd UniversalVideoView callback"); } }); ##Note
Customization##
##
TODO
LicenseCopyright 2015 The UniversalVideoView author <[email protected]>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.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License. |
请发表评论