I have an app which displays up to 12 short (~ 6 second) mp4 videos sequentially, however despite seemingly overcoming the problem as reported in this thread, again I'm having some of the videos randomly not showing. The watchdog timer (Timer5) I implemented ensures the display continues to the next video, but I'd like to fix this "random" problem so all videos show.
Here's an extract of the code which includes the relevant subs:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
As can be seen, I repeatedly use Mediaview1 and issue a
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
command prior to initializing MediaView1 ready to display the next video. The error which occurs causing a random video in the sequence not to show is captured by
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and this is an example:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
but the media is valid because most times all videos display in sequence.
I wonder whether
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
is sufficient to truly dispose of all resources ready for the initialization again and so perhaps Mediaview1 is not completely ready to be initialized or perhaps memory is not completely cleared leading to these random errors. Although I'm yet to find a video file size that never throws an error, it does seem reducing the size of the video files is beneficial, eg. 2mb files appear to error less than 5mb files.
Because it's random, I'm finding it hard to systematically diagnose the cause and so any ideas ideas/suggestions would be warmly received.
			
			Here's an extract of the code which includes the relevant subs:
			
				B4X:
			
		
		
		Private MediaView0, MediaView1 As MediaView
Sub PlayerIntros
    ' Show videos or images of players in that preferential order
    ' Players
    For Each k As Object In mapHomeTeam.Keys
        Dim playerId As String = mapHomeTeam.Get(k)
        For a = 0 To mapHomeTeam.Size - 1
        If playerId = arrayHome(a, 0) Then  
                Dim mediaFile As String = arrayHome(a, 1).SubString(arrayHome(a, 1).IndexOf(" ") + 2)                                  
                If IntroVideos(mediaFile & ".mp4", arrayHome(a, 1).SubString2(0, 2).Trim) = True Then
                    Timer5.Enabled = True
                    wait For video_Complete
                    Display.playernumber.As(B4XView).SendToBack
                    MediaView1.Dispose
                    Timer5.Enabled = False
                Else if IntroImages(mediaFile & ".png", arrayHome(a, 1).SubString2(0, 2).Trim) = True Then
                    Sleep(txtIntrosDelay.text * 1000)
                    Display.ivGraphics.visible = False
                Else
                    IntroImages("noImageFile.png", arrayHome(a, 1).SubString2(0, 2).Trim)
                    Sleep(txtIntrosDelay.text * 1000)
                    Display.ivGraphics.visible = False
                End If
        End If
        Next
    Next
End Sub
Sub mpp_Complete
    CallSubDelayed(Me, "video_Complete")
End Sub
Sub IntroVideos(videoFile As String, pNum As String ) As Boolean    'Player - first initial dot space secondname dot MP4, player singlet number / Coaches & Team Managers - firstname dot space secondname dot MP4, ""
    Display.playerNumber.text = pNum
    Display.playerNumber.visible = True
    If File.Exists(PublicApplicationDataFolder & "\Intros\" & cmbOrganisationID.Value, videoFile) = True Then
        MediaView1.Initialize(Me, "mpp")
        MediaView1.DesignerCreateView(Display.fullPane, Null, Null)
        MediaView1.Source = File.GetUri(PublicApplicationDataFolder & "\Intros\" & cmbOrganisationID.Value, videoFile)
        MediaView1.play
        MediaView1.Volume = 0        'Mute player intro video clips
        Display.playernumber.As(B4XView).BringToFront
'        Log (pNum & " | " & videoFile & " | True")
        Return True
    Else
        Display.playernumber.As(B4XView).BringToFront
'        Log (pNum & " | " & videoFile & " | False")
        Return False
    End If
End Sub
	As can be seen, I repeatedly use Mediaview1 and issue a
			
				B4X:
			
		
		
		MediaView1.Dispose
	
			
				B4X:
			
		
		
		Sub mpp_Error (Message As String)
    Log("Intro videos error: " & Message)
End Sub
	
			
				B4X:
			
		
		
		Intro videos error: MediaException: UNKNOWN : [com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer@260da058] ERROR_MEDIA_INVALID: ERROR_MEDIA_INVALID
	I wonder whether
			
				B4X:
			
		
		
		MediaView1.Dispose
	Because it's random, I'm finding it hard to systematically diagnose the cause and so any ideas ideas/suggestions would be warmly received.