There was little surprise that a number of the White House Press Corps applauded as Barack Obama completed his final news conference.

He had started thanking the media for its work, and ended by declaring them to be a vital part of the democratic process, and said that “having you in this building has helped this place work better”.

He added: “That does not, of course, mean that I’ve enjoyed every story that you have filed, but that’s the point of this relationship... you’re supposed to be skeptics, you’re supposed to ask me tough questions. You’re not supposed to be complimentary, but you’re supposed to cast a critical eye on folks who hold enormous power.”

Barack Obama honours his press secretary at final briefing

He continued: “I spent a lot of time on my – in my farewell address talking about the state of our democracy. It goes without saying that essential to that is a free press. So America needs you and our democracy needs you.”

What a contrast to the man who is going to take his place on Friday. Donald Trump has not only talked about moving the White House press corps out of the White House – something he says is all about lack of space – but he has shown a persistent scorn and disgrace for reporters trying to go about their work.

Scum, he has called them, the lowest of the low. Horrible people. At his first press conference as President-elect, Mr Trump even went as far as to refuse a question from CNN because he was upset about its report about an intelligence dossier containing unverified claims about him. “Fake news”, he shouted at the network’s reporter, seated in the front row.

Obama has hardly been perfect on the issue of the media and press freedom. The Obama administration used the Espionage Act to go after whistleblowers who leaked to journalists, more than all previous administrations combined.

His administration has even gone after the reporters themselves. It called one of them, James Rosen of Fox News, a potential “co-conspirator” with his government source. Meanwhile, James Risen of the New York Times, faced a jail sentence unless he revealed a government source – something he declined to do.

On other issues, such as the use of unmanned drones in places such as Pakistan and Afghanistan, Obama has refused to provide even the most basic information to the media. “For the most part, they’ve been very precise precision strikes against al-Qaeda and their affiliates, and we’re very careful in terms of how it’s been applied,” he once said, dismissing well-documented evidence that many civilians have been killed by American drones.

But for all of this, Obama has accepted the role and place of the media in society. Mr Trump, by contrast, has talked about tightening US libel laws to make them more like those in the UK, and has repeatedly threatened to sue the media.

Obama covered a lot of ground in his final White House press conference – his 165th by one count. He defended his decision to commute the sentence of whistleblower Chelsea Manning, said claims of voter fraud had been “disproved”, and acknowledged that a key reason Mr Trump won the election was because many people feel “forgotten and disenfranchised. They feel as if they're being looked down on”.

“You don't want to have an America in which a very small sliver of people are doing really well and everybody else is fighting for scraps,” he said.

He also said he did not believe the expansion of LGBT rights in the US that had taken place on his watch, was reversible. He urged Mr Trump to continue trying to persuade Russia to reduce its nuclear stockpiles.

He also said that while he had a “cordial” relationship, with Mr Trump, he did not expect there would be many policy goals they shared.

“I don’t expect that there is going to be enormous overlap,” he said, speaking on Wednesday afternoon.

Yet, as he looked out from lectern in the White House briefing room this one last time, it was – appropriately enough – the media and his relationship with it, that he returned to before he concluded.

He said that when reporters questioned him on issues such as why he had not done more to stop the spread of Ebola in West Africa in 2014 or the oil leaking into the Gulf of Mexico in 2010, “it allows me to go back to my team and say, ‘Will you get this solved before the next press conference?’ ”

He finished, by saying that at his core, he believed “we’re going to be ok”.