B4J Question Catching INVALID MEDIA video link error in SMM

MikeH

Well-Known Member
Licensed User
Longtime User
Would it be possible to catch this error - or better still, play the video?

Error log:
Jun 13, 2023 5:48:51 AM com.sun.javafx.webkit.prism.WCMediaPlayerImpl onError
WARNING: onError, errCode=260, msg=ERROR_MEDIA_INVALID
Jun 13, 2023 5:51:17 AM com.sun.javafx.webkit.prism.WCMediaPlayerImpl onError
WARNING: onError, errCode=260, msg=ERROR_MEDIA_INVALID
Jun 13, 2023 5:51:17 AM com.sun.javafx.webkit.prism.WCMediaPlayerImpl onError
WARNING: onError, errCode=260, msg=ERROR_MEDIA_INVALID
Jun 13, 2023 5:51:17 AM com.sun.javafx.webkit.prism.WCMediaPlayerImpl onError
WARNING: onError, errCode=260, msg=ERROR_MEDIA_INVALID
Jun 13, 2023 5:51:17 AM com.sun.javafx.webkit.prism.WCMediaPlayerImpl onError
WARNING: onError, errCode=260, msg=ERROR_MEDIA_INVALID
1   00007FFC78FE8B10
2   00007FFC78FD82E2
3   00007FFC7903F085
4   000002B947A1D8B8

This is the link I was using but it happens for others too.
https ://www.youtube.com/ watch?v=FcG8tm-IbXI (added spaces to prevent the video showing here)

My research says the cause of "ERROR_MEDIA_INVALID" is trying to show a res higher than 1920x1080 so a way to check the res before loading may be a way to prevent the error. How can I do that - if being able to play the video is not possible?

My code is quite simple so I don't think its that

B4X:
Main.smm.SetMediaWithExtra(wPreview.pPreview, path, "", _
CreateMap(Main.smm.REQUEST_BACKGROUND: Main.xui.Color_RGB(B4XPages.MainPage.BGred, B4XPages.MainPage.BGgreen, B4XPages.MainPage.BGblue), _
Main.smm.REQUEST_FADE_ANIMATION_DURATION: B4XPages.MainPage.Fade, _
Main.smm.DefaultRequestTimeout: B4XPages.MainPage.TimeOut))


It all works fine with most YouTube links.

Thank you :)
 

TILogistic

Expert
Licensed User
Longtime User
??
B4X:
Private Sub MediaView1_StateChanged (State As String)
    Log(State)
    Log(MediaView1.jMedia.RunMethod("getWidth", Null))
    Log(MediaView1.jMedia.RunMethod("getHeight", Null))
  
End Sub

1686646288452.png


note:
B4X:
    MediaView1.jMedia.RunMethod("setFitWidth", Array(Width))
    MediaView1.jMedia.RunMethod("setFitHeight", Array(Height))

Ref:
1686646726077.png
 
Last edited:
Upvote 0
Top