Android Question [SOLVED][SMM] Autoplay can't in B4A default

winjiadh

Active Member
Licensed User
Longtime User
I pressed the autoplay post on the forum and wanted to test autoplay
I'm in B4A, and I have a new default
Added the code,
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("2")
    MediaManager.Initialize
    #if SMM_VIDEO
    MediaManager.SetMediaWithExtra(pnlVideo,"https://bestvpn.org/html5demos/assets/dizzy.mp4", "", CreateMap(MediaManager.REQUEST_CALLBACK: Me))
    Wait For (pnlVideo) SMM_MediaReady (Success As Boolean, Media As SMMedia)
    Dim playerview As SimpleExoPlayerView = pnlVideo.GetView(0).GetView(0)
    playerview.UseController = False
    Dim player As SimpleExoPlayer = playerview.Tag
    player.Play
    #End If
End Sub
I press Ctrl+B,and in the Conditional Symbols, add "SMM_VIDEOSMM_VIDEO“
20230612102617.jpg

but it says an error, it can't run
20230612102405.jpg

I don't know where I went wrong
Hope someone can help me
Thank you
 

Attachments

  • default.zip
    12.7 KB · Views: 147
Solution
I don't understand why there is no explanation, you can only use B4XPages to achieve automatic playback, you can't use default to achieve automatic playback, maybe change me to other
Erel has explained Here Post #10
Notes:
1. The callback (Me in this case) must be a class, such as a B4XPages page.

Me is used just in B4XPages page.
For default project, you have to add a class module to do CallBack
Note: The default project is not recommended.

walterf25

Expert
Licensed User
Longtime User
I pressed the autoplay post on the forum and wanted to test autoplay
I'm in B4A, and I have a new default
Added the code,
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("2")
    MediaManager.Initialize
    #if SMM_VIDEO
    MediaManager.SetMediaWithExtra(pnlVideo,"https://bestvpn.org/html5demos/assets/dizzy.mp4", "", CreateMap(MediaManager.REQUEST_CALLBACK: Me))
    Wait For (pnlVideo) SMM_MediaReady (Success As Boolean, Media As SMMedia)
    Dim playerview As SimpleExoPlayerView = pnlVideo.GetView(0).GetView(0)
    playerview.UseController = False
    Dim player As SimpleExoPlayer = playerview.Tag
    player.Play
    #End If
End Sub
I press Ctrl+B,and in the Conditional Symbols, add "SMM_VIDEOSMM_VIDEO“
View attachment 142860
but it says an error, it can't run
View attachment 142858
I don't know where I went wrong
Hope someone can help me
Thank you
I ran your project and I also get the same error, unfortunately I don't have much experience with the SimpleMediaManager library.

Seems to be a problem with the actual library buy I can be wrong.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I pressed the autoplay post on the forum and wanted to test autoplay
I'm in B4A, and I have a new default
Added the code,
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("2")
    MediaManager.Initialize
    #if SMM_VIDEO
    MediaManager.SetMediaWithExtra(pnlVideo,"https://bestvpn.org/html5demos/assets/dizzy.mp4", "", CreateMap(MediaManager.REQUEST_CALLBACK: Me))
    Wait For (pnlVideo) SMM_MediaReady (Success As Boolean, Media As SMMedia)
    Dim playerview As SimpleExoPlayerView = pnlVideo.GetView(0).GetView(0)
    playerview.UseController = False
    Dim player As SimpleExoPlayer = playerview.Tag
    player.Play
    #End If
End Sub
I press Ctrl+B,and in the Conditional Symbols, add "SMM_VIDEOSMM_VIDEO“
View attachment 142860
but it says an error, it can't run
View attachment 142858
I don't know where I went wrong
Hope someone can help me
Thank you
Figured out the problem was that you needed to create a B4XPages project for it to work, it says so in post #10 of the thread where Erel introduces this library.

Attached i've created a B4XPages and tested, the project works just fine on my end.
 

Attachments

  • SMM_Example.zip
    11.7 KB · Views: 137
Upvote 1

aeric

Expert
Licensed User
Longtime User
For Default template, just use the example for ExoPlayer

 
Upvote 0

winjiadh

Active Member
Licensed User
Longtime User
Figured out the problem was that you needed to create a B4XPages project for it to work, it says so in post #10 of the thread where Erel introduces this library.

Attached i've created a B4XPages and tested, the project works just fine on my end.

Figured out the problem was that you needed to create a B4XPages project for it to work, it says so in post #10 of the thread where Erel introduces this library.

Attached i've created a B4XPages and tested, the project works just fine on my end.
Yes, I downloaded the example written in B4XPages, so it can indeed be played
I don't understand why there is no explanation, you can only use B4XPages to achieve automatic playback, you can't use default to achieve automatic playback, maybe change me to other parameters can play it
20230608191307.jpg

but I haven't found the answer yet, thank you for your detailed reply
 
Upvote 0

winjiadh

Active Member
Licensed User
Longtime User
For Default template, just use the example for ExoPlayer

thanks your replay
but I hope to figure it out

SimpleMediaManager (SMM) library​

not the

ExoPlayer library​

 
Upvote 0

teddybear

Well-Known Member
Licensed User
I don't understand why there is no explanation, you can only use B4XPages to achieve automatic playback, you can't use default to achieve automatic playback, maybe change me to other
Erel has explained Here Post #10
Notes:
1. The callback (Me in this case) must be a class, such as a B4XPages page.

Me is used just in B4XPages page.
For default project, you have to add a class module to do CallBack
Note: The default project is not recommended.
 

Attachments

  • default.zip
    13.2 KB · Views: 152
Last edited:
Upvote 0
Solution

winjiadh

Active Member
Licensed User
Longtime User
Erel has explained Here Post #10
Notes:
1. The callback (Me in this case) must be a class, such as a B4XPages page.

Me is used just in B4XPages page.
For default project, you have to add a class module to do CallBack
Note: The default project is not recommended.
Perfect,you are great! thanks
 
Upvote 0
Top