Enjoy this library from B4A https://github.com/PierfrancescoSoffritti/AndroidYouTubePlayer
YouTube player based on WebView, because the one provided by Google is soo bad :| (Original library words )
Notes:
Uses appcompat library
YouTubePlayerView
Author: SMM
Version: 0.01
Sample :
YouTube player based on WebView, because the one provided by Google is soo bad :| (Original library words )
Notes:
B4X:
@DependsOn(values={"android-support-v4"})
YouTubePlayerView
Author: SMM
Version: 0.01
- YouTubePlayerView
Events:- _enterfullscreen
- _exitfullscreen
- _ready
- ba As BA
- BringToFront
- 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)
- cueVideo (videoId As String, startSeconds As Float)
- enterFullScreen
- exitFullScreen
- isFullScreen As Boolean
- loadVideo (videoId As String, startSecond As Float)
- pauseVideo
- playVideo
- release
- seekTo (time As Int)
- showTitle (show As Boolean)
- toggleFullScreen
- android.permission.ACCESS_NETWORK_STATE
- android.permission.INTERNET
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
Sample :
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim yt As YouTubePlayerView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
yt.Initialize("yt")
Activity.AddView(yt,0,0,100%x,50%y)
End Sub
Sub yt_ready
Log("Youtube view is ready")
yt.loadVideo("UwikLSIm1UI", 0)
yt.playVideo
End Sub
Sub Activity_Resume
End Sub
Sub yt_enterfullscreen
Log("FullScreen")
End Sub
Sub yt_exitfullscreen
Log("ExitFullScreen")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
yt.release
End Sub
Attachments
Last edited: