S sorex Expert Licensed User Longtime User Jun 25, 2022 #1 Hello, I'm updating a library where a video player is implented in. But when the video starts and finishes I expected some events to trigger but that's not happening at all. Now I noticed in the log these 2 "ignoring event: eventname_event" I thought they would trigger when reverting back to the calling activity but that isn't the case either. Is there anything to do about this?
Hello, I'm updating a library where a video player is implented in. But when the video starts and finishes I expected some events to trigger but that's not happening at all. Now I noticed in the log these 2 "ignoring event: eventname_event" I thought they would trigger when reverting back to the calling activity but that isn't the case either. Is there anything to do about this?
drgottjr Expert Licensed User Longtime User Jun 25, 2022 #2 the event is being triggered; you're ignoring it. that's what it's telling you. don't ignore it. consume it. the documentation will tell you which events the library raises. you create a sub for that event using whatever eventname you assigned when you initialized the library. B4X: library.initialize("myevent") sub myevent_whatevertheeventiscalled log("whateverevent" & " was triggered") end sub let's say the library has a "finished" event. you'll do: B4X: sub myevent_finished( something as string ) log("finished: " & something) end sub the event may or may not pass any values. in my example above, it passes a string for you to use. it could be something else or maybe even nothing. it is possible the library was not implemented with b4a in mind, but the fact that you see a log entry means that the library is trying to talk to b4a through an event. Upvote 0
the event is being triggered; you're ignoring it. that's what it's telling you. don't ignore it. consume it. the documentation will tell you which events the library raises. you create a sub for that event using whatever eventname you assigned when you initialized the library. B4X: library.initialize("myevent") sub myevent_whatevertheeventiscalled log("whateverevent" & " was triggered") end sub let's say the library has a "finished" event. you'll do: B4X: sub myevent_finished( something as string ) log("finished: " & something) end sub the event may or may not pass any values. in my example above, it passes a string for you to use. it could be something else or maybe even nothing. it is possible the library was not implemented with b4a in mind, but the fact that you see a log entry means that the library is trying to talk to b4a through an event.
S sorex Expert Licensed User Longtime User Jun 25, 2022 #3 I'm not ignoring anything All the other events work right but the video player is like starting another activity or something. Before that ignore line it shows this ** Activity (main) Pause, UserClosed = false ** Upvote 0
I'm not ignoring anything All the other events work right but the video player is like starting another activity or something. Before that ignore line it shows this ** Activity (main) Pause, UserClosed = false **
S sorex Expert Licensed User Longtime User Jun 25, 2022 #4 and it's all "routed" to one event so I'm not missing a sub either as the others (loaded, loadfailed, videoclosed) prove that it works. Upvote 0
and it's all "routed" to one event so I'm not missing a sub either as the others (loaded, loadfailed, videoclosed) prove that it works.
agraham Expert Licensed User Longtime User Jun 25, 2022 #5 B4A does ignore events under certain conditions and posts to the logs that it has done so. Commonly when displaying an error Msgbox but in this case probably because the Activity to run the event in is paused. The event is discarded. The exact circumstance isn't clear but from "reverting back to the calling activity " it looks like the video player is in a separate activity so I don't know why the events should be raised in a different activity. More clarification needed as to how the video player is called. If it is your code trying to raise the even in the calling thread try using CallSubDelayed. B4XPages will never lose events if you switched to using it. Upvote 1
B4A does ignore events under certain conditions and posts to the logs that it has done so. Commonly when displaying an error Msgbox but in this case probably because the Activity to run the event in is paused. The event is discarded. The exact circumstance isn't clear but from "reverting back to the calling activity " it looks like the video player is in a separate activity so I don't know why the events should be raised in a different activity. More clarification needed as to how the video player is called. If it is your code trying to raise the even in the calling thread try using CallSubDelayed. B4XPages will never lose events if you switched to using it.
S sorex Expert Licensed User Longtime User Jun 25, 2022 #6 it's a rewarded video ad that apparently is not running inside my own activity. I was hoping to get the videocompleted event working to process the reward but it's one of the 2 ignored ones. I can (ab)use the videoclosed event tho as that hits when the video activity is closed and it's back in my own. (and the close X button only appears at the end of the video so it's kind of safe to do so) Upvote 0
it's a rewarded video ad that apparently is not running inside my own activity. I was hoping to get the videocompleted event working to process the reward but it's one of the 2 ignored ones. I can (ab)use the videoclosed event tho as that hits when the video activity is closed and it's back in my own. (and the close X button only appears at the end of the video so it's kind of safe to do so)
Erel B4X founder Staff member Licensed User Longtime User Jun 26, 2022 #7 Switch to B4XPages and forget from the complex activities life cycle. Upvote 0
S sorex Expert Licensed User Longtime User Jun 26, 2022 #8 In what way would that make a difference when that ad still runs in it's own activity and not a B4XPages page? Upvote 0
In what way would that make a difference when that ad still runs in it's own activity and not a B4XPages page?
agraham Expert Licensed User Longtime User Jun 26, 2022 #9 As I understand it (though not in detail) B4XPages uses a feature of Android to keep running in the background and so can still process events. You will see in the logs when the app goes into the background ** Activity (main) Pause event (activity is not paused). ** Upvote 0
As I understand it (though not in detail) B4XPages uses a feature of Android to keep running in the background and so can still process events. You will see in the logs when the app goes into the background ** Activity (main) Pause event (activity is not paused). **
MicroDrie Well-Known Member Licensed User Longtime User Jun 26, 2022 #10 sorex said: In what way would that make a difference when that ad still runs in it's own activity and not a B4XPages page? Click to expand... Perhaps that the "rewarded video ad" developer don't want to be able to manipulate rewards with the misuse of events at all? Upvote 0
sorex said: In what way would that make a difference when that ad still runs in it's own activity and not a B4XPages page? Click to expand... Perhaps that the "rewarded video ad" developer don't want to be able to manipulate rewards with the misuse of events at all?
S sorex Expert Licensed User Longtime User Jun 26, 2022 #11 I had some difficulties to get it working right with B4XPages but now all events are coming through! Thanks for the hint(s). Upvote 0
I had some difficulties to get it working right with B4XPages but now all events are coming through! Thanks for the hint(s).