Giter Site home page Giter Site logo

Comments (12)

iielse avatar iielse commented on June 16, 2024

额,在你问这个问题前,我就实现了这个功能,最新代码里面有。 等我发个版

from imageviewer.

iielse avatar iielse commented on June 16, 2024

我本来是打算有bug,或者有人提到需要的时候再发,结果才没一天就有人需要了

from imageviewer.

iielse avatar iielse commented on June 16, 2024

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.

SoloLee avatar SoloLee commented on June 16, 2024

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.

SoloLee avatar SoloLee commented on June 16, 2024

设置scaleType属性,就会把视频画面给裁剪了。
我的想法实现是类似 腾讯等视频 从竖屏小窗口变为横屏大窗口后全屏播放,视频画面不会被裁剪。是不是需要对ExoVideo进行配置?我暂时还没找到ExoVideo配置的api。

from imageviewer.

iielse avatar iielse commented on June 16, 2024

横屏大窗口这个只需要新开一个Activity来播放.退出Activity的时候同步video播放的时间轴状态即可

from imageviewer.

SoloLee avatar SoloLee commented on June 16, 2024

嗯,nice!感谢

from imageviewer.

iielse avatar iielse commented on June 16, 2024

有个具体的思路你可以尝试
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.

iielse avatar iielse commented on June 16, 2024

不过我写的ExoVideoViewonDetachedFromWindow 的时候会release. 这里还需要提供个变量来控制是否自动release ...

from imageviewer.

iielse avatar iielse commented on June 16, 2024

@SoloLee 看下最新代码, 我顺手实现了这个功能,你照着demo抄即可

from imageviewer.

SoloLee avatar SoloLee commented on June 16, 2024

@SoloLee 看下最新代码, 我顺手实现了这个功能,你照着demo抄即可

呀,非常感谢

from imageviewer.

SoloLee avatar SoloLee commented on June 16, 2024

非常感谢,思路有了。赞

from imageviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.