Code Monkey home page Code Monkey logo

exoplayerfilter's People

Contributors

code-deleter-circolo avatar dungnguyen115 avatar grangert avatar masayukisuda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exoplayerfilter's Issues

TextureView and Resize Mode

Thank you for this library @MasayukiSuda. I was wondering if is possible to add a TextureView of this approach to have regular View animations like scaling, fading, etc.

Also: Is this library also allows me to use "resize_mode" like SimpleExoPlayerView? "fixed_height" is a scale that I can't move from it. Currently I can't have the video full screen with that resize mode crop.

Thanks in advance!

How to use a green screen filter that renders the video color or transparency?

I would like to play a video that uses the color green to indicate transparency.

I already have a shader that is working with another video playback library, but I would like to get the power of ExoPlayerFilter in the app instead.

Here is a gif of the video I would like to filter

Example video

Shader code

precision mediump float;
varying vec2 vTextureCoord;
uniform lowp sampler2D sTexture;

void main() {
    lowp vec4 color = texture2D(sTexture, vTextureCoord);
    vec3 green = vec3(0.173, 0.435, 0.078);

    if (color.r <= green.r && color.b <= green.b) {
        // dont render anything (transparent) // this doesnt work
        // gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); // also shows black instead of transparent
    } else {
        color.r = color.r * 1.6;
        color.b = color.b * 1.6;
        if (color.r >= 1.0 || color.b >= 1.0) {
            color.g = color.g * 1.6;
        } else {
            color.g = color.g * 1.2;
        }

        float a = distance(green, vec3(color.r, color.g, color.b));
        gl_FragColor = vec4(color.r, color.g, color.b, a);
    }
}
// this did not help
ePlayerView.holder.setFormat(PixelFormat.TRANSPARENT)

When I use this shader with DEFAULT_VERTEX_SHADER it shows black in place of the green. How can this be transparent instead?

Portrait videos cropped

Great library! Congrats.

I can see you have thought about different options for fitting the surface inside the parent (playerScaleType), but probably haven't gotten round to finishing it. So if you put a portrait video into the library it fills the width and therefore crops the top and bottom of the video.

I figure this must be a solved problem somewhere. Would the code from VideoView not do what you (I) need?

I can just override onMeasure for now, so it isn't a problem.

Application cache with Exoplayer 2.7.0

Hello,

I update Exoplayer to 2.7.0 but have problem in your library about Listener then I revert Exoplayer version 2.6.1

03-05 18:42:31.721 14389-14389/com.videoplayer E/AndroidRuntime: FATAL EXCEPTION: main Process: com.videoplayer, PID: 14389 java.lang.NoSuchMethodError: No virtual method addVideoListener(Lcom/google/android/exoplayer2/SimpleExoPlayer$VideoListener;)V in class Lcom/google/android/exoplayer2/SimpleExoPlayer; or its super classes (declaration of 'com.google.android.exoplayer2.SimpleExoPlayer' appears in /data/app/com.videoplayer-2/split_lib_dependencies_apk.apk) at com.daasuu.epf.EPlayerView.setSimpleExoPlayer(EPlayerView.java:46) at com.videoplayer.editvideo.FilterVideoFragment.setUpGlPlayerView(FilterVideoFragment.kt:84) at com.videoplayer.editvideo.FilterVideoFragment.onResume(FilterVideoFragment.kt:97) at android.support.v4.app.Fragment.performResume(Fragment.java:2387) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1467) at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:1230) at android.support.v4.app.FragmentManagerImpl.startPendingDeferredFragments(FragmentManager.java:1857) at android.support.v4.app.FragmentManagerImpl.doPendingDeferredStart(FragmentManager.java:2704) at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2220) at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:649) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145) at android.support.v4.view.ViewPager.populate(ViewPager.java:1238) at android.support.v4.view.ViewPager.populate(ViewPager.java:1086) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1616) at android.view.View.measure(View.java:18870) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464) at android.view.View.measure(View.java:18870) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464) at android.view.View.measure(View.java:18870) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at android.view.View.measure(View.java:18870) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464) at android.view.View.measure(View.java:18870) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141) at android.view.View.measure(View.java:18870) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:721) at android.widget.LinearLayout.onMeasure(LinearLayout.java:612) at android.view.View.measure(View.java:18870) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at android.view.View.measure(View.java:18870) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:721) at android.widget.LinearLayout.onMeasure(LinearLayout.java:612) at android.view.View.measure(View.java:18870) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:3076) at android.view.View.measure(View.java:18870) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2392) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1416) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1661) at android.view.ViewRootImpl.doTra

SimpleExoPlayer: Player is accessed on the wrong thread.

Hello,
When i launch the sample from branch master I get the following error :


W/SimpleExoPlayer: Player is accessed on the wrong thread. See https://exoplayer.dev/issues/player-accessed-on-wrong-thread
    java.lang.IllegalStateException
        at com.google.android.exoplayer2.SimpleExoPlayer.verifyApplicationThread(SimpleExoPlayer.java:1242)
        at com.google.android.exoplayer2.SimpleExoPlayer.setVideoSurface(SimpleExoPlayer.java:321)
        at com.daasuu.epf.EPlayerRenderer.onSurfaceCreated(EPlayerRenderer.java:103)
        at com.daasuu.epf.EFrameBufferObjectRenderer.onSurfaceCreated(EFrameBufferObjectRenderer.java:40)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1259)

Same issue when i try to use the lib in my project.

Any idea ? Thanks in advance

How to set MovieWrapperView to full screen?

Hi, its really cool library to play with.

However, I am trying to set full screen MovieWrapperView, but I am not able to do so.
I tried setting height width in XML to match parent and tried to set it through java file too, but not getting perfect result. Can you please guide me.

Thanks in advance.

Can’t add the library to the project

When trying to add your library to a project using implementation 'com.github.MasayukiSuda:ExoPlayerFilter:v0.2.4' I get an error

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.MasayukiSuda:ExoPlayerFilter:v0.2.4.

Full text - https://hasteb.in/evuqaruw.sql

Maybe you know the solution?

Get current frame

Is there a possibility to retrieve the current frame from EPlayerView?

滤镜问题

我想实现一个类似GPUImageColorMatrixFilter 传矩阵的颜色怎么实现呢

Wrong thread exoplayer crash, loading video from file.

        exoPlayer!!.repeatMode=Player.REPEAT_MODE_ALL
        exoPlayer!!.playWhenReady=true
        playerView = EPlayerView(this)
        playerView.setSimpleExoPlayer(exoPlayer)
      playerView.setLayoutParams(RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
        (findViewById<RelativeLayout>(R.id.player_view)).addView(playerView)
        playerView.onResume()
        playerView.setGlFilter(GlSepiaFilter())
        if(!started)playNext()
    }

-------------------------------------------------------------------------------------------------------------------------------------

 2019-09-27 04:41:44.053 29865-29898/me.xx.xxxx W/SimpleExoPlayer: Player is accessed on the wrong thread. See https://exoplayer.dev/issues/player-accessed-on-wrong-thread
    java.lang.IllegalStateException
        at com.google.android.exoplayer2.SimpleExoPlayer.verifyApplicationThread(SimpleExoPlayer.java:1231)
        at com.google.android.exoplayer2.SimpleExoPlayer.setVideoSurface(SimpleExoPlayer.java:321)
        at com.daasuu.epf.EPlayerRenderer.onSurfaceCreated(EPlayerRenderer.java:103)
        at com.daasuu.epf.EFrameBufferObjectRenderer.onSurfaceCreated(EFrameBufferObjectRenderer.java:40)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1539)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
2019-09-27 04:41:44.055 29865-29898/me.xx.xxxx E/[EGL-ERROR]: __egl_platform_cancel_buffers:644: surface->num_buffers(4) ```

-------------------------------------------------------------------------------------------------------------------------------------


ExoPlayer Core Version 2.10.2 & 2.10.4
Android Version: Oreo GO
Tried using layout instead of doing it programmatically but is the same.


------------------------------------------------------------------------------------------------------------------------------------

Tried sample app, and is working, but in my app it continues to crash.

how can it rotate the video?

There is a video with rotation 90, when i play the video, not shown in the right direction, how can i fix it?

How to use the Vintage Filter

I've used your exoplayerfilter and it is working fine. What I'm looking for is a vintage filter, do we have vintage filter? If not then please give some suggestion for some way to inculcate in this filter. Thanks

How to rotate EPlayerView?

I want to rotate the video but i couldn't find any method, I have tried rotate the parent layout but it wasn't successful

Remove Filter(No Filter) option is not there

I wan to remove filter with the press of a button and come back to normal. I've searched on this library I couldn't found any thing for removing the filter or coming back to normal.

Please let me know if there is anything from which I can remove the filter like setting the filters. Thanks.

Save files with the applied filter

The work is almost done, now I've to save the filtered video in the local storage. I'm searching for a way out to do that. Do we have something to save the video with the applied filter. As when we apply filter to some video. How to do we get the value of the changed video in order to save it in the specified path.

Thanks

How to rotate EPlayerView ?

During rotaion EPlayerView is gone .
anybody have solution for this?

I used
Matrix.rotateM(MVPMatrix, 0, 90, 0, 0, 1);
but video is strached. Please help me

I refer #8 but no one answered here

I can't use SimpleExoPlayerView after include this library in all over app.!

If I use this library and use SimpleExoPlayerView for simple use for other work then:

java.lang.NoSuchMethodError: No interface method addListener(Lcom/google/android/exoplayer2/ExoPlayer$EventListener;)V in class Lcom/google/android/exoplayer2/ExoPlayer; or its super classes (declaration of 'com.google.android.exoplayer2.ExoPlayer' appears in /data/app/com.emergingcoders.socio-1/base.apk)

So, I currently forget to use this library!

I have problem for setup view with kotlin

I try to add video filter with video view at my fragment in my application which add video filter before to save this follow example in README.md with kotlin

private fun setUpSimpleExoPlayer() {
        val bandwidthMeter = DefaultBandwidthMeter()
        val videoTrackSelectionFactory = AdaptiveTrackSelection.Factory(bandwidthMeter)
        val trackSelector = DefaultTrackSelector(videoTrackSelectionFactory)

        val defaultBandwidthMeter = DefaultBandwidthMeter()
        val dataSourceFactory = DefaultDataSourceFactory(context, Util.getUserAgent(context, "Video-editor"), defaultBandwidthMeter)
        val extractorsFactory = DefaultExtractorsFactory()
        val videoSource = ExtractorMediaSource(Uri.parse(getString(R.string.sample_media_mp4_portrait)), dataSourceFactory, extractorsFactory, null, null)

        player = ExoPlayerFactory.newSimpleInstance(context, trackSelector)

        player.prepare(videoSource)
        player.playWhenReady = true
    }
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.daasuu.epf.EPlayerView
        android:id="@+id/layoutMovieWrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

and have error at this which I cannot to fix this, what should I do about this?

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.SimpleExoPlayer.setVideoSurface(android.view.Surface)' on a null object reference
at com.daasuu.epf.EPlayerRenderer.onSurfaceCreated(EPlayerRenderer.java:103)
at com.daasuu.epf.EFrameBufferObjectRenderer.onSurfaceCreated(EFrameBufferObjectRenderer.java:40)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1539)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1278)

glTexParameterf -> glTexParameteri

GLES20.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag);
GLES20.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, min);

not use glTexParameterf

Make videos fit a particular layout

I am having trouble rendering the video in a way that it fits the layout.
((FrameLayout) findViewById(R.id.videoView3)).addView(ePlayerView);
I have defined a frame layout, and it takes a particular width and height, however when I add this player in this view, it does not fit, it only stretches till the video height.

I want it to scale to the height and width of the layout.

createContext failed: EGL_BAD_CONFIG

About opengl some device hava an Exception:createContext failed: EGL_BAD_CONFIG,
like VIVO Android 8.1
Please help me how to solve it.Thank you very much.

Latest ExoPlayer

It would be great if the library didn't include ExoPlayer itself, which would make it possible to update ExoPlayer whenever new updates come in. Right now there are bug fixes in the latest ExoPlayer release which I can't use with this library.

Using latest exoplayer core version

hey,

I'd like to use your lib along with the latest exoplayer version 2.6.1
however in the lib is used version 2.6.0, which makes build fail due to different versions.
It is possible to change lib version to the latest one?
p.s. I've tried it locally, works ok, no additional efforts required.

some device will crash when apply GlMonochromeFilter and GlVignetteFilter, the way of using glUniform3fv might be wrong

device: Huawei V8
android version: 8.0
gl info:
vendor:Arm version:OpenGL ES 3.2
renderer:Mali-T880

the demo will crash when i select GlMonochromeFilter or GlVignetteFilter .
after a try , i found out change the following code will fix crash.

GLES20.glUniform3fv(getHandle("xxxxx"), 0, vignetteColor, 0); ---- will crash
to
GLES20.glUniform3fv(getHandle("xxxxx"), 1, vignetteColor, 0); ------ this works for me

I'm not good at opengl es, so I'm not sure about this .
any way, could you please check this ?
thanks for this gorgeous project!

About RENDER_MODE.

I saw you code rendering rate depend on video decode rate.

and then try to send request to GLThread call drawframe function.

however the GLsurfaceView render mode is not dirty mode, that means remaining continue mode.

in my view, should set dirty mode better way.

How to flip(mirror effect) ?

I have been doing this change either by using scaleX = -1 in xml or using texture view.
Using scaleX gives me black screen and I can't use texture view with this player.
Can you add a method to flip the video? @MasayukiSuda

Change EPlayerView size according to video size

I have a problem here, need to resize the EPlayerView size to fit in specific size the video leaving left and right part transparent if video is vertical. As for now in your demo video is horizontal and if I put a vertical video it will be put across the whole screen. Is there a way to resize the EPlayerView according to video size?

About PreviewFilter

GLES20.glBindTexture(GL_TEXTURE_2D, 0); should be GLES20.glBindTexture(texTarget, 0);

In Draw function.

Default video access cannot be played after Android 8

I found the following error log when running in the emulator.
Pixel 2 API 29 - Android 9.+
I think this is due to some restriction introduced after android 8. See
https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted

2019-07-01 16:48:33.175 4984-5723/com.daasuu.exoplayerfilter E/ExoPlayerImplInternal: Source error.
    com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to http://www.html5videoplayer.net/videos/toystory.mp4
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:194)
        at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:147)
        at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:844)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.io.IOException: Cleartext HTTP traffic to www.html5videoplayer.net not permitted
        at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:124)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:462)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:429)
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:350)
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:192)

Surface not released

Should you release the Surface you create in EPlayerRenderer when you finish using the EPlayerView? Otherwise you are leaking the Surface. You can see this by enabling StrictMode and creating and destroying an Activity with an EPlayerView.

I also notice that you have a release method in ESurfaceTexture that I couldn't see being used. Should that also be called?

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.