While giving presentations in conferences or talks in research meetings, is it ok to self-advertise that I'm on the job market (academic or industry)? Is it advisable or does it make more sense to mention that during networking in teams?
It is ok, but it may not be ideal. Academia often frowns upon open self-promotion (more than it probably should, in my opinion), and flat out saying that you're on the market in a public presentation seems a little...well, "desperate" is too strong, but the next thing, perhaps.
Some thoughts about how/when/whether to do this:
Cultural nuances can vary in very subtle and localized ways. If you are going to a big conference in your profession or field, there must be other people there who are on the job market. Look to them and see how they are behaving: is anyone else advertising their availability in their presentations? If not, maybe don't do it yourself without an especially good reason. If so, look to the audience members and see how they're reacting. A little face-reading will probably tell you whether people are happy to hear this kind of information.
Consider trying to disburse this information slightly less directly. For instance, ending a talk with something like "Please come talk to me if you're interested in X [or, by implication, me]. I would be very interested to take these things further." Then, when someone talks to you one-on-one or in a small group, you can work the fact that you're on the market organically into the conversation.
Whenever you go to a conference and you're on the job market, concentrate on making meaningful academic and social connections with people, especially potential employers. Don't prioritize selling yourself directly. If they meet you and like you and your work, you can follow up later by letting them know you're on the market. And you should.
In circumstances such as this, a little levity can help a lot. Outright saying
I need a job, please hire me!
is going to come across as desperate, melodramatic or tacky. Presenting it a little bit more humorously:
And if you'd be interested in a postdoctoral associate who can tell you about X, I may be able to help you out. . . .
Or something in a similar vein will not. You'll make your point, but it won't come across too negatively. Of course, if a potential advisor isn't amused by such a comment, this could be problematic—but I'd argue that someone who has no sense of humor whatsoever might not be a good advisor to have in the first place.