B4A Library EasyVideoPlayer

This is a wrap for this github project.

EasyVideoPlayer
Author:
DonManfred (wrapper)
Version: 1.51
  • EasyVideoPlayer
    Events:
    • onBuffering (percent As Int)
    • onCompletion ( As )
    • onError (error As String)
    • onPrepared ( As )
    • onPreparing ( As )
    • onRetry (source As Uri)
    • onSubmit (source As Uri)
    • onVideoProgressUpdate (position As Int, duration As Int)
    Fields:
    • LEFT_ACTION_NONE As Int
    • LEFT_ACTION_RESTART As Int
    • LEFT_ACTION_RETRY As Int
    • RIGHT_ACTION_CUSTOM_LABEL As Int
    • RIGHT_ACTION_NONE As Int
    • RIGHT_ACTION_SUBMIT As Int
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • disableControls
    • enableControls (andShow As Boolean)
    • hideControls
    • isControlsShown As Boolean
    • isPlaying As Boolean
    • isPrepared As Boolean
    • pause
    • release
    • reset
    • seekTo (pos As Int)
    • showControls
    • start
    • stop
    • toggleControls
    Permissions:
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
    Properties:
    • AutoPlay As Boolean [write only]
    • Background As Drawable
    • BottomLabelText As CharSequence [write only]
    • Color As Int [write only]
    • CurrentPosition As Int [read only]
    • CustomLabelText As CharSequence [write only]
    • Duration As Int [read only]
    • Enabled As Boolean
    • Height As Int
    • HideControlsOnPlay As Boolean [write only]
    • InitialPosition As Int [write only]
    • Left As Int
    • LeftAction As Int [write only]
    • Parent As Object [read only]
    • PauseDrawable As Drawable [write only]
    • PauseDrawableRes As String [write only]
    • PlayDrawable As Drawable [write only]
    • PlayDrawableRes As String [write only]
    • RestartDrawable As Drawable [write only]
    • RestartDrawableRes As String [write only]
    • RetryText As CharSequence [write only]
    • RightAction As Int [write only]
    • Source As String [write only]
    • SubmitText As CharSequence [write only]
    • Tag As Object
    • ThemeColor As Int [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • evpex.zip
    18.3 KB · Views: 886
  • EasyVideoPlayerLIB.zip
    26.7 KB · Views: 809
  • JAVAsrc.zip
    12.7 KB · Views: 685

MarcoRome

Expert
Licensed User
Longtime User
Hi Don. Great library. I have this error when start:
java.lang.NoSuchFieldError: No static field Theme of type [I in class Landroid/support/v7/appcompat/R$styleable; or its superclasses (declaration of 'android.support.v7.appcompat.R$styleable' appears in /data/app/JHS.EasyVideoPlayer-2/base.apk)
at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:306)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:244)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:114)
at JHS.EasyVideoPlayer.main.onCreate(main.java:59)
at android.app.Activity.performCreate(Activity.java:6575)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3278)
at android.app.ActivityThread.access$1000(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6912)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
 

DonManfred

Expert
Licensed User
Longtime User
Did you changed this to match your paths?
B4X:
#AdditionalRes: $AdditionalLibs$\b4a_appcompat, de.amberhome.objects.appcompat
 

susu

Well-Known Member
Licensed User
Longtime User
Hi @DonManfred

I copied Appcompat lib and res to Additional Libraries and changed the path:
#AdditionalRes: C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: D:\android-sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

But I got this error:

B4X:
Generating R file.    Error
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
 

aidymp

Well-Known Member
Licensed User
Longtime User
Hi @DonManfred

I copied Appcompat lib and res to Additional Libraries and changed the path:
#AdditionalRes: C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: D:\android-sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

But I got this error:

B4X:
Generating R file.    Error
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

I have had to reinstall the Android SDK and it seems the newer versions the SDK downloads are missing some files! i just had to solve the google play services problem, for another app, and now I dont have the android-sdk\extras\android\support\v7\appcompat\res folder either! any clue as to how to solve this, the google play one is easy to find on google and sort but i can see anything regarding this!
 

Johan Schoeman

Expert
Licensed User
Longtime User
I get the following on my S4 mini with KitKat and have been battling with this for a few days now:

B4X:
LogCat connected to: 24be32de
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
in init
GOT UP TO HERE
main_activity_create (java line: 322)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
    at JHS.EasyVideoPlayer.main._activity_create(main.java:322)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at JHS.EasyVideoPlayer.main.afterFirstLayout(main.java:102)
    at JHS.EasyVideoPlayer.main.access$000(main.java:17)
    at JHS.EasyVideoPlayer.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5593)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
    ... 17 more
Caused by: android.view.InflateException: Binary XML file line #46: Error inflating class ImageButton
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
    at com.afollestad.easyvideoplayer.EasyVideoPlayer.init(EasyVideoPlayer.java:252)
    at com.afollestad.easyvideoplayer.EasyVideoPlayer.<init>(EasyVideoPlayer.java:73)
    at de.donmanfred.EasyVideoPlayerWrapper._initialize(EasyVideoPlayerWrapper.java:75)
    ... 21 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/evp_action_restart.xml from drawable resource ID #0x7f02004d
    at android.content.res.Resources.loadDrawable(Resources.java:3443)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
    at android.widget.ImageView.<init>(ImageView.java:133)
    at android.widget.ImageButton.<init>(ImageButton.java:88)
    at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:57)
    at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:53)
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:118)
    at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
    at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1031)
    at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
    ... 27 more
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:986)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:930)
    at android.content.res.Resources.loadDrawable(Resources.java:3439)
    ... 37 more
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi @DonManfred

I copied Appcompat lib and res to Additional Libraries and changed the path:
#AdditionalRes: C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: D:\android-sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

But I got this error:

B4X:
Generating R file.    Error
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
I had a similar sort of problem when I wrapped a Github project and solved it by removing the values-v23 folder from this path (below is my folder path)
C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res

Try it - maybe it works...it should divert to values-v22 and just perhaps it solves your problem
 

NJDude

Expert
Licensed User
Longtime User
Hi @DonManfred

I copied Appcompat lib and res to Additional Libraries and changed the path:
#AdditionalRes: C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: D:\android-sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

But I got this error:

B4X:
Generating R file.    Error
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
d:\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Are you compiling using SDK 23? (Check your B4A paths: Tools - > Configure Paths -> Android.jar)

AppCompat is a pain in the ass sometimes.
 

MarcoRome

Expert
Licensed User
Longtime User
Did you changed this to match your paths?
B4X:
#AdditionalRes: $AdditionalLibs$\b4a_appcompat, de.amberhome.objects.appcompat
Of Course Don. But anyway i think that depend on the new sdk 30 ( really a nightmare )
I say this because i have also tried an older version that uses de.amberhome.objects.appcompat is i have the same problem.

java.lang.NoSuchFieldError: No static field Theme of type [I in class Landroid/support/v7/appcompat/R$styleable; or its superclasses (declaration of 'android.support.v7.appcompat.R$styleable' appears in /data/app/com.devil.color-1/base.apk)
at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:306)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:244)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:114)
at com.devil.color.main.onCreate(main.java:59)
at android.app.Activity.performCreate(Activity.java:6575)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3278)
at android.app.ActivityThread.access$1000(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6912)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
--------- beginning of system
** Activity (main) Pause, UserClosed = true **

Look movie ( same error with 2 apps different ) :



Another think if you look new SDK you have this situation - Android Support Library ( Obsolete )


Immagine.jpg



I'd go back to the "old" SDK Android....
Someone know there are other sources where to install the Android SDK previous full ??
Thank you
 

aidymp

Well-Known Member
Licensed User
Longtime User
I had a similar sort of problem when I wrapped a Github project and solved it by removing the values-v23 folder from this path (below is my folder path)
C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res

Try it - maybe it works...it should divert to values-v22 and just perhaps it solves your problem

Yes! that works!

Thanks

Aidy
 

MarcoRome

Expert
Licensed User
Longtime User
I get the following on my S4 mini with KitKat and have been battling with this for a few days now:

B4X:
LogCat connected to: 24be32de
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
in init
GOT UP TO HERE
main_activity_create (java line: 322)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
    at JHS.EasyVideoPlayer.main._activity_create(main.java:322)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at JHS.EasyVideoPlayer.main.afterFirstLayout(main.java:102)
    at JHS.EasyVideoPlayer.main.access$000(main.java:17)
    at JHS.EasyVideoPlayer.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5593)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
    ... 17 more
Caused by: android.view.InflateException: Binary XML file line #46: Error inflating class ImageButton
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
    at com.afollestad.easyvideoplayer.EasyVideoPlayer.init(EasyVideoPlayer.java:252)
    at com.afollestad.easyvideoplayer.EasyVideoPlayer.<init>(EasyVideoPlayer.java:73)
    at de.donmanfred.EasyVideoPlayerWrapper._initialize(EasyVideoPlayerWrapper.java:75)
    ... 21 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/evp_action_restart.xml from drawable resource ID #0x7f02004d
    at android.content.res.Resources.loadDrawable(Resources.java:3443)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
    at android.widget.ImageView.<init>(ImageView.java:133)
    at android.widget.ImageButton.<init>(ImageButton.java:88)
    at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:57)
    at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:53)
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:118)
    at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
    at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1031)
    at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
    ... 27 more
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:986)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:930)
    at android.content.res.Resources.loadDrawable(Resources.java:3439)
    ... 37 more

Hi Johan. Now, that i update SDK i have same problem. Do you have solved this ?
Thank you
 

itgirl

Active Member
Licensed User
Longtime User
Hello , i think im having troubles trying to add the view pragmatically

B4X:
Dim MovPlayer As EasyVideoPlayer
MovPlayer.Initialize("MovPlayer")
VideoPanel.AddView(MovPlayer, 0, 0, VideoPanel.Width,VideoPanel.Height)

returns

B4X:
android.view.InflateException: Binary XML file line #46: Error inflating class android.widget.ImageButton
 

itgirl

Active Member
Licensed User
Longtime User
OK thanks to ;)DonManfred;) for posting the source code which i really thank him for, I learned alot from his contributions to this community i figured the problem was in CustomViewWrapper.replaceBaseWithView so i decided to play around with this i tried to just noramlly addview base.AddView(getObject() and Whoa the error is gone and everything woked again... so i just have to change things a bit and try to get the height and width correctly and everything is up and working again


thanks Don;)
 
Top