achank
Member
Hi everyone, I hope you're all staying healthy. Sorry, I'm having a problem, but perhaps some of you have also experienced this and are willing to share a solution. I've been using this library for two years https://www.b4x.com/android/forum/threads/androidyoutubeplayer.70948/ and about a week ago, it stopped working. I assume it's due to a new policy or rule from YouTube, causing the YouTube player to stop playing videos.
This is the simple code I used
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The libraries I used are appcompat and youtubeplayerview , Thank you for your attention.
			
			This is the simple code I used
			
				YoutubePlayerView:
			
		
		
		#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
    #AdditionalRes: D:\B4A\Exoplayer\Youtube view player 2\res
    #AdditionalJar: com.android.support:support-v4
'    #Extends: android.support.v7.app.AppCompatActivity
    #BridgeLogger: True
#End Region
    
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub
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
    Private Panel1 As Panel
    Private ButtonPause As Button
    Private ButtonPlay As Button
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("layout")
    yt.Initialize("yt")   
    Panel1.AddView(yt,0,0,100%x,50%y)
End Sub
Sub yt_ready
    Log("Youtube view is ready")
    yt.loadVideo("IRzni8851wI", 0) '4YwNW8OlvqU
    yt.playVideo
End Sub
Sub Activity_Resume
    Log("Resume")
    yt.loadVideo("IRzni8851wI", 0) '4YwNW8OlvqU
    yt.playVideo
End Sub
Sub yt_enterfullscreen
    Log("FullScreen")
'    yt.loadVideo("UnmznFua_9s", 0)
'    yt.playVideo
End Sub
Sub yt_exitfullscreen
    Log("ExitFullScreen")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
    yt.release
    Log("Pause")
End Sub
Private Sub ButtonPause_Click
    yt.pauseVideo
End Sub
Private Sub ButtonPlay_Click
    yt.loadVideo("IRzni8851wI", 0) '4YwNW8OlvqU
    yt.playVideo
End Sub
	The libraries I used are appcompat and youtubeplayerview , Thank you for your attention.