Comments (12)
额,在你问这个问题前,我就实现了这个功能,最新代码里面有。 等我发个版
from imageviewer.
我本来是打算有bug,或者有人提到需要的时候再发,结果才没一天就有人需要了
from imageviewer.
implementation 'com.github.iielse:imageviewer:2.1.18'
具体使用方法看demo. demo下方有6个按钮,第一排第二个
找个合适的位置设置下 com.github.iielse.imageviewer.utils.Config.VIDEO_SCALE_TYPE = ExoVideoView.SCALE_TYPE_XXX
如果想对单个ExoVideoView
特殊配置调用setScaleType方法
from imageviewer.
implementation 'com.github.iielse:imageviewer:2.1.18'
具体使用方法看demo. demo下方有6个按钮,第一排第二个 找个合适的位置设置下com.github.iielse.imageviewer.utils.Config.VIDEO_SCALE_TYPE = ExoVideoView.SCALE_TYPE_XXX
如果想对单个ExoVideoView
特殊配置调用setScaleType方法
OK,感谢,我试试
from imageviewer.
设置scaleType属性,就会把视频画面给裁剪了。
我的想法实现是类似 腾讯等视频 从竖屏小窗口变为横屏大窗口后全屏播放,视频画面不会被裁剪。是不是需要对ExoVideo进行配置?我暂时还没找到ExoVideo配置的api。
from imageviewer.
横屏大窗口这个只需要新开一个Activity来播放.退出Activity的时候同步video播放的时间轴状态即可
from imageviewer.
嗯,nice!感谢
from imageviewer.
有个具体的思路你可以尝试
VideoViewHolder 下的 exoVideoView 被点击时刻,将exoVideoView和他的parent脱离,保存到静态变量中
新开的Activity在onCreate时刻 将 exoVideoView粘到新的parent上. 同时将老的parent放在弱引用中保留
在FullVideoActivity finish的时刻,将exoVideoView和他新的parent再次脱离,如果之前的parent还在内存中 粘回之前的parent上.同时将引用置空
这样的好处就是没有创建新的 exoVideoView. 过程始终是一个实例,性能和体验方面当是上佳之选。
伪代码如下:
exoVideoView.setOnClickListener {
FullVideoActivity.start(it.context, it)
}
class FullVideoActivity extends Activity {
static WeakRef<ViewGroup> weakRefVideoViewParent;
static ExoVideoView videoView;
onCreate() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
val view = videoView ?: returnAndFinish()
weakRefVideoViewParent.put(view.parent)
view.parent.remove(view)
contentView.addView(view)
}
finish() {
val view = videoView ?: return
view.parent.remove(view)
weakRefVideoViewParent?.get()?.add(view)
weakRefVideoViewParent = null
}
static fun start(Context context, VideoView view) {
videoView = view
context.startActivity()
}
}
from imageviewer.
不过我写的ExoVideoView
在onDetachedFromWindow
的时候会release
. 这里还需要提供个变量来控制是否自动release
...
from imageviewer.
@SoloLee 看下最新代码, 我顺手实现了这个功能,你照着demo抄即可
from imageviewer.
@SoloLee 看下最新代码, 我顺手实现了这个功能,你照着demo抄即可
呀,非常感谢
from imageviewer.
非常感谢,思路有了。赞
from imageviewer.
Related Issues (20)
- 使用该库一堆冲突 implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0' HOT 2
- 视频播放内存溢出 HOT 5
- 我只需要加载一张图片,有没有能直接一行代码就可以调用,其他的设置全部默认? HOT 1
- 线上的包报了一个崩溃,在android 9 11 12上偶现,下面是堆栈信息 HOT 6
- 请问怎么通过sensor感应实现视频横屏竖屏播放 HOT 8
- PlayerControlView显示隐藏不更新进度问题 HOT 1
- 支持图片旋转吗
- 是否支持视频播放
- 是否支持视频进度条展示横屏进度展示,长按下载保存本地 HOT 1
- 希望能优化横屏的缩放过渡动画 HOT 2
- SubsamplingScaleImageView 可以升级下到AndroidX吗 HOT 1
- 请教一个问题,大图怎么延伸到状态栏上面呢 HOT 2
- 内存问题 HOT 1
- 可以使用fresco吗 HOT 4
- 请问拖拽的时候我想让底部页面的图片消失(alpha=0),该如何实现 HOT 1
- 是否有Java使用版本? HOT 1
- SubsamplingScaleImageView 使用问题 HOT 1
- 没有过度动画,SimpleTransformer的getView方法返回null HOT 3
- 希望作者再简化下使用,目前使用成本太高了。。。 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imageviewer.