Code Monkey home page Code Monkey logo

android-scalablevideoview's People

Contributors

piasy avatar yqritc 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

android-scalablevideoview's Issues

YouTube videos

Hi,

How can I use the library to watch youtube videos?

Thanks.

Surface Release Issue on KitKat

Anyone can help me soon?

04-13 06:50:26.468 17685-17702/com.gp.edition29n E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'release' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at android.view.Surface.setNativeObjectLocked(Surface.java:423)
at android.view.Surface.(Surface.java:141)
at com.yqritc.scalablevideoview.ScalableVideoView.onSurfaceTextureAvailable(ScalableVideoView.java:58)
at android.view.TextureView.getHardwareLayer(TextureView.java:370)
at android.view.View.updateDisplayListIfDirty(View.java:15086)
at android.view.View.getDisplayList(View.java:15132)
at android.view.View.draw(View.java:15907)
at android.view.ViewGroup.drawChild(ViewGroup.java:3703)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3497)
at android.view.View.draw(View.java:16189)
at android.view.View.updateDisplayListIfDirty(View.java:15109)
at android.view.View.getDisplayList(View.java:15132)
at android.view.View.draw(View.java:15907)
at android.view.ViewGroup.drawChild(ViewGroup.java:3703)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3497)
at android.view.View.updateDisplayListIfDirty(View.java:15104)
at android.view.View.getDisplayList(View.java:15132)
at android.view.View.draw(View.java:15907)
at android.view.ViewGroup.drawChild(ViewGroup.java:3703)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3497)
at android.view.View.updateDisplayListIfDirty(View.java:15104)
at android.view.View.getDisplayList(View.java:15132)
at android.view.View.draw(View.java:15907)
at android.view.ViewGroup.drawChild(ViewGroup.java:3703)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3497)
at android.view.View.draw(View.java:16189)
at android.widget.FrameLayout.draw(FrameLayout.java:592)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2923)
at android.view.View.updateDisplayListIfDirty(View.java:15109)
at android.view.View.getDisplayList(View.java:15132)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:275)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:281)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:320)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2751)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2584)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2176)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5938)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

Does not work in KitKat 4.4.4

Exception: E/MediaPlayer: Should have subtitle controller already set - in UI black screen. Could you help please?

Scroll auto play/pause

@yqritc , thank for awesome library. i love it!
Can you please add features auto play/pause when scroll like facebook app ?

Problem in optimization scalable

I am using React Native and React Native video for creating streaming TV app. I monitored TV app in resize mode contain and resize mode cover, when I use cover CPU work increase 40%
first image with resize mode contain
photo_2022-04-25_17-38-01

Problem with ScalableVideoView in Recycler view

I noticed problem while checking out demo of your library on Google Play Store. I was using Nexus 5X with Android 6.0 on board. The problem I noticed happened with video list - RecyclerView in this case. While scrolling up and down for some row display black view instead of video view. Please refer to attached screenshots.

screenshot_20151108-215532
screenshot_20151108-215540

Android Studio Compile Error

Hi,

Android Studio is not going to compile and run, any suggestions?

Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages

Error:Execution failed for task ':sample:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

Bug: no audio after repeating

I use this:

        videoView.setRawData(R.raw.test)
        videoView.isLooping = true
        videoView.setVolume(1f, 1f)
        videoView.prepare { videoView.start() }

And this in layout file:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <com.yqritc.scalablevideoview.ScalableVideoView
        android:id="@+id/videoView" android:layout_width="match_parent" android:layout_height="match_parent"
        app:scalableType="centerCrop"/>
</RelativeLayout>

Yet for some reason, after the first playback, I can't hear anything. How come?

Attached sample project.
MyApplication.zip

is it possible to playing the specific frame?

I wan to create a function to playing the video as GIFs.
For example, the length of the video is 2 second (fixed). The frame rate is 12/s. Total frame is 24.
When i clicked the button, the scalableVideoView will show no.10 frame.

Black screen when playing in floating window

Hi,
I'm using WindowManager to show the video player as a floating video, like in the first answer here

but for some reason the VideoView is black (the audio works fine).
what can i do to make it work?
thanks.

Error while playing on large screen

On Samsung SM-T561 (Android 4.4.4 , screen 9.6" , video size 852x480) video plays only few frames and then sucks. Here is some logs
V/MediaPlayer-JNI: native_setup V/MediaPlayer: constructor V/MediaPlayer: setListener V/MediaPlayer-JNI: setDataSourceFD: fd 83 V/MediaPlayer: setDataSource(83, 9577788, 6756456) V/MediaPlayer: message received msg=8, ext1=0, ext2=0 V/MediaPlayer: notify(8, 0, 0) callback on disconnected mediaplayer V/MediaPlayer: setVideoSurfaceTexture V/MediaPlayer: prepareAsync V/MediaPlayer-JNI: start V/MediaPlayer: start E/MediaPlayer: start called in state 4 V/MediaPlayer: message received msg=100, ext1=-38, ext2=0 E/MediaPlayer: error (-38, 0) V/MediaPlayer: callback application V/MediaPlayer: back from callback D/chooseAuthTag: onResume: V/MediaPlayer: setVideoSurfaceTexture V/MediaPlayer: message received msg=5, ext1=852, ext2=480 V/MediaPlayer: New video size 852 x 480 V/MediaPlayer: callback application V/MediaPlayer: back from callback V/MediaPlayer: message received msg=1, ext1=0, ext2=0 V/MediaPlayer: prepared V/MediaPlayer: callback application V/MediaPlayer: back from callback E/MediaPlayer: Error (-38,0) W/MediaPlayer: this is IMEDIA_PLAYER_VIDEO_EXIST I/MediaPlayer: sendBroadcast android.media.IMediaPlayer.videoexist E/MediaPlayer: Should have subtitle controller already set V/MediaPlayer: getVideoWidth V/MediaPlayer-JNI: getVideoWidth: 852 V/MediaPlayer: getVideoHeight V/MediaPlayer-JNI: getVideoHeight: 480 D/chooseAuthTag: onPrepared: 852 480 W/MediaPlayer: this is IMEDIA_PLAYER_VIDEO_EXIST I/MediaPlayer: sendBroadcast android.media.IMediaPlayer.videoexist V/MediaPlayer-JNI: start V/MediaPlayer: start V/MediaPlayer-JNI: setLooping: 1 V/MediaPlayer: MediaPlayer::setLooping D/MainActivity: onLoadFinished for loader 1106886632 I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@4240b028 time:216923358 V/MediaPlayer: message received msg=5, ext1=852, ext2=480 V/MediaPlayer: New video size 852 x 480 V/MediaPlayer: callback application V/MediaPlayer: back from callback V/MediaPlayer: message received msg=6, ext1=0, ext2=0 W/MediaPlayer: this is IMEDIA_PLAYER_VIDEO_EXIST V/MediaPlayer: Received MEDIA_STARTED V/MediaPlayer: callback application V/MediaPlayer: back from callback I/MediaPlayer: sendBroadcast android.media.IMediaPlayer.videoexist V/MediaPlayer-JNI: getCurrentPosition: 40 (msec) V/MediaPlayer-JNI: isPlaying: 1 V/MediaPlayer: message received msg=200, ext1=3, ext2=0 W/MediaPlayer: info/warning (3, 0) V/MediaPlayer: callback application V/MediaPlayer: back from callback V/MediaPlayer: message received msg=100, ext1=1, ext2=-110 E/MediaPlayer: error (1, -110) V/MediaPlayer: callback application V/MediaPlayer: back from callback V/MediaPlayer: message received msg=7, ext1=0, ext2=0 E/MediaPlayer: Error (1,-110) V/MediaPlayer: unrecognized message: (7, 0, 0) V/MediaPlayer: callback application V/MediaPlayer: back from callback V/MediaPlayer-JNI: getCurrentPosition: 3292 (msec) V/MediaPlayer-JNI: isPlaying: 0

Blink in Api Level19

In api level19, I view video in list and when there are to videoview in the screen, sometimes you can find the above videoview will blink badly. Only in api level19, you can find this problem easily.

MediaPlayer initialization

I think MediaPlayer should be initialized in constructor (not in setDataSource like now) because start/stop/pause etc. methods throw NullPointerException if data source hasn't been set yet.

is Pobile to play video from url?

I want to play video from url,as is inherit from MediaPlayer I suppose it cans,has something specifilc?

Im not able to play it

Thanks!

Issue memory leak with ViewPager

I got my VIewPager adapter for scalableVideoView on play
than I everytime I go to homescreen or switch app
I got error like:
A/OpenGLRenderer: Leaked 2 GPU objects!
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 19002 (RenderThread)

(I assumed that the onDetachedFromWindow is not called when ViewPager is not focus on the played video, I cannot test it )

NullPointerException from mMediaPlayer

If I scroll up right after I scroll down until the item view (playing a video) moves out of screen, the video cannot play. When I click on the video to trigger pause/start, the app gives me a NullPointerException indicating that mMediaPlayer is null. How can I fix it?

[Android] App crash when unmounting video

Hey,
I have route with a react-native-video component, the route is not currently focused, when unmounting the route the app crashes with the following error.

02-13 14:53:42.879  3774  3774 E AndroidRuntime: java.lang.IllegalStateException
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.media.MediaPlayer.isPlaying(Native Method)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.yqritc.scalablevideoview.ScalableVideoView.isPlaying(ScalableVideoView.java:209)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.yqritc.scalablevideoview.ScalableVideoView.onDetachedFromWindow(ScalableVideoView.java:84)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.brentvatne.react.ReactVideoView.onDetachedFromWindow(ReactVideoView.java:524)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.View.dispatchDetachedFromWindow(View.java:14555)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4789)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.ViewGroup.removeAllViews(ViewGroup.java:4735)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.views.view.ReactViewManager.removeAllViews(ReactViewManager.java:252)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.views.view.ReactViewManager.removeAllViews(ReactViewManager.java:41)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:536)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:533)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:533)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager$1.onAnimationEnd(NativeViewHierarchyManager.java:420)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.layoutanimation.LayoutAnimationController$1.onAnimationEnd(LayoutAnimationController.java:131)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.animation.Animation$3.run(Animation.java:376)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5417)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

From what I could find in the docs:

IllegalStateException if the internal player engine has not been initialized or has been released.

My Video component is in a background route (i.e. there is a route on top of it) so maybe the video gets release when not visible and that causes the isPlaying to throw?

Thanks!

Getting ANR on Android because of Video view

Hey there! thanks for the awesome library, i just currently have one issue.
I am getting a ANR for a lot of users with stack trace mentioned below

main (unknown): tid=1 systid=6019
       at android.media.MediaHTTPConnection.disconnect(MediaHTTPConnection.java:193)
       at android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:132)
       at android.os.Binder.execTransactInternal(Binder.java:1166)
       at android.os.Binder.execTransact(Binder.java:1130)
       at android.media.MediaPlayer._reset(MediaPlayer.java)
       at android.media.MediaPlayer.reset(MediaPlayer.java:2252)
       at com.yqritc.scalablevideoview.ScalableVideoView.reset(ScalableVideoView.java:248)
       at com.yqritc.scalablevideoview.ScalableVideoView.release(ScalableVideoView.java:252)
       at com.brentvatne.react.ReactVideoView.cleanupMediaPlayerResources(ReactVideoView.java:242)
       at com.brentvatne.react.ReactVideoViewManager.onDropViewInstance(ReactVideoViewManager.java:56)
       at com.brentvatne.react.ReactVideoViewManager.onDropViewInstance(ReactVideoViewManager.java:17)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:635)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:646)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:646)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:646)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:499)
       at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:217)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1138)
       at android.view.Choreographer.doCallbacks(Choreographer.java:962)
       at android.view.Choreographer.doFrame(Choreographer.java:883)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1125)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:263)
       at android.app.ActivityThread.main(ActivityThread.java:8263)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)

Playing video stored in device storage

I want to play video which is stored in external storage.I tried using below code but its not working.

contentVideoView.setDataSource(context,Uri.parse(Environment.getExternalStorageDirectory() + "/demo.mp4"));

contentVideoView.start();

contentVideoView.setLooping(true);

Also I tried

contentVideoView.setDataSource(Environment.getExternalStorageDirectory() + "/demo.mp4");
contentVideoView.start();
contentVideoView.setLooping(true);

but it also didn't worked.

Add a scalable camera view?

This is a great library. I noticed that since you're using a TextureView as the base view (and not VideoView), the same scaling can also be applied to a TextureView attached to a Camera. I see that ScalableVideoView has a lot of media player logic in it. Is it possible to have a version that doesn't use the media player and performs scaling using CameraParams

black view when back from other activity

When jump to an other activity from the current one which contains the video view while the video is playing and then come back again to the video activity, the video view shows black.

video has gray border around it in Android 6.

Hi,

It's a great library :). I recently used it to scale my video. It works perfectly in Android5. However, in android 6, my video always has a gray border.
Here's my code:


<com.yqritc.scalablevideoview.ScalableVideoView
android:id="@+id/video_view"
android:layout_width="200dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
app:scalableType="centerCrop"
/>

Since my parent background is white, the gray border of the video looks ugly right now. Could you please help me with that ? Thanks. :)

Stuck view

ScalableVideoview is getting stuck while playing HD video in Recyclerview.

crash in isPlaying

if we don't set data source and directly call isPlaying, it crashes.
so it's better to check whether mMediaPlayer is null or not beforehand.

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.