It's widely established that The DCU and Marvel Universe exist in the same... Multiverse? Megaverse? Adjacent multiverses? Same something. They met on several occasions, and the universes even merged for a while in the early 90s.
There's even a gag during a Marvel VS. DC mini (prior to Amalgam) where a man walks into a toy/novelty store, as if he'd done so regularly before the universal collide, and asked where all the "X-Men Stuff" had gone. The clerk responded, "What's X-Men?" Maquettes of two characters should tell you the universe in which this transpired.
DC, prior to 1986 and Crisis on Infinite Earths, did this using Earth-2 and claiming that the Earth-1 characters had comics about the Earth-2 characters but not about themselves. This explanation worked for characters like The Flash, but wouldn't make sense for someone like Superman, where both versions had the same secret identity.
On Earth-1, they did reveal that there's "true crime" comics based on the adventures of Earth-1's Superman, Batman, etc. (based on newspaper accounts, etc.), alongside the fictional-to-them comics about the Earth-2 Flash, Green Lantern, etc.'s adventures.
A Batman arc from the '80s involved Batman investigating the murder of a comic-book writer who worked on a Batman comic. At one point Bruce Wayne admits to himself, "I should have seen this coming." He mentioned that he couldn't risk copyrighting the Batman name without blowing the Secret Identity. The in-universe Batman comic, interestingly enough, portrayed the Caped Crusader as a penitent bat-headed demon who came to Earth to send criminals to Hell Ghost Rider-style.
An issue of The Flash shows that Irey West has a poster from the Teen Titans cartoon in her room. Ya know, the cartoon that had her dad as a guest star. Though interestingly enough, the cartoon rarely if ever used the heroes' real names. So in theory, Teen Titans could absolutely be a TV show in the DC Universe without jeopardizing the identities of the actual Titans.
In a few issues of the Silver Age Teen Titans series, the kids actually hid their helicopter behind a billboard advertising the Adam WestBatman show. One wonders how Robin would feel about Burt Ward's portrayal of him.
In The Multiversity, at least part of DC's output in the main DCU (Earth-0) is actually inspired by other Earths in The Multiverse; it's no longer limited to just one Earth as it was pre-Crisis on Infinite Earths (where DC's output in Earth-One, the main DCU, was inspired by the heroes of Earth-Two). Marvel Comics have a DC analogue in Major Comics, with their output being inspired by the heroes of Earth-7 and Earth-8.
However, at least in the Marvel Universe, there is Canon evidence from comics such as She-Hulk and Fantastic Four that the exploits of the (in-universe) real live heroes are actually recorded in comics and sold to the general public. These comics (in the She-Hulk comics) are then used as evidence by lawyers defending and prosecuting super heroes and super villains. And, at least once, to save the world when all the characters had forgotten some hugely important fact or MacGuffin which they found out about by reading the comics. One wonders, though, if the comics published in-universe are the same as the Real Life ones, and the references to comics are infinitely recursive. But then one's head starts hurting.
Similarly, after his Silver Age revival, Captain America ended up drawing his own comic book in-universe. Which is even more mind-bending; the superhero was drawing a comic book about his own adventures? Hard to know what's really true. Note that at the time, Cap's true identity as Steve Rogers was not publicly known, so the publisher had no idea he had Captain America drawing Captain America.
Marvel actually released a set of in-universe comics during a Fifth Week Event in 2000. These were titled "Marvels Comics" and how similar they were to the "real" superheroes varied — the Fantastic Four licensed their comic officially and appeared in their real identities, but since nobody knows who Daredevil or Spider-Man are, the in-universe comic fabricated origins for them.
The infinitely recursive references problem would only apply if heroes continued licensing their adventures to comic companies all the way up to the modern era, which they don't seem to do.
Ed Brubaker's Captain America run revealed that the Captain America film serial from the 1940's exists in the Marvel Universe. There's a bit of Fridge Brilliance to this: in real life, the serial changed up Cap's origin and name so that his civilian identity was Grant Gardner rather than Steve Rogers. Ergo, the serial could exist in the Marvel Universe without having jeopardized the real Cap's secret identity in any way.
In a "What the...!" short story The Thing (Ben Grimm) storms Marvel's office about the comics adaptation of a short encounter with a joke-villain. The match lasts all of a single second, where the comic depicts "[...] several pages of blows... all on my head!". When authors lament that not all of the Fantastic Four's real adventure are epic enough, The Thing starts using his own kind of diplomacy to discourage future humiliations.
Patsy Walker was a comic from The Golden Age of Comic Books about teenagers similar to the Archie Comics gang. Patsy Walker is currently the Super Hero Hellcat. It turns out that "Patsy Walker" and "Patsy and Hedy" comics exist in-universe and are exactly the same as the ones in Real Life: Patsy's mother wrote the comic, using her daughter and her friends as characters, and reality (that is, Hellcat's actual teenage life) was the inspiration — meaning the comics are not the exact way her past went, but she does know people with those names who were sorta like that.
Superman # 411 established that the Julius Schwartz of Earth-1 went bankrupt after he unveiled Ultra-Man, Madame Miracle, Night Wizard, and Jet Jordan only to see the emergence of the Earth-1 Superman (as Superboy), the Batman, Wonder Woman, and the Flash (whether they meant the publication of Jay Garrick's adventures on Earth-1 or the emergence of Barry Allen remains unclear — also, other stories established that the Shadow actually existed as part of Earth-1's past, so Night Wizard would have already seemed a tad redundant). Possibly, Madame Miracle explains how Wonder Woman seemingly appeared on the copy of All-Star Comics # 37 that Barry Allen had in Flash # 137; otherwise people on Earth-1 would have felt astonished when the Earth-1 Wonder Woman left Paradise Island to enter Man's World. (On a related note, no word ever appeared on what the people of Midway City, Michigan felt when someone dressed in a virtually identical costume to Hawkman emerged, and a museum curator named Carter Hall moved into town.) While the Earth-1 Julius Schwartz seemingly appeared as a gainfully employed staff member of the Earth-1 DC Comics in the Titans Crisis crossover, the Teen Titans Index # 5 notes that this represented a different bald, glasses wearing-staff member.
When Ultimate Spidey went to Raimi to ask him to stop, they just filmed him some more. The majority of the movie in the Ultimate universe was made up of real footage from a battle between Spidey and Dock Ock. Naturally, Peter doesn't see a dime from it and resents the movie, which ought to reflect poorly on Raimi and Maguire but it mainly comes off as Rule of Funny.
For some reason Avi Arad was also on set, apparently as a creative consultant. How he got that job is never really explained.
Marvel did another joke on this in Spider-Girl; Mary Jane comments that Reilly Tyne (son of Spider-Man's clone Ben Reilly) looks sort of like Peter; Pete, on the other hand, thinks he looks more like Tobey Maguire.
Also subverted in the Ultimate Marvel universe: when discussing which actors should play the various members of the Ultimates, Nick Fury nominates Samuel L. Jackson for himself. This being an obvious meta-reference, as Marvel had based Ultimate Nick Fury's likeness on Jackson, with the agreement that they'd cast him for the movie version when the time came.
Marvel loves doing this; characters will always be compared to whoever's playing them in a recent or upcoming film. Hilariously, Pete Wisdom playfully posed as Professor X and said "make it so!" at one point... long before the X-Men movies with Patrick Stewart. When those films (or comics) exist in-universe, it's for reasons similar to the Batman example: writers will make stories about them and they can't exactly claim copyright without revealing their Secret Identity. We never get enough details of what's in those books to know for sure but they probably aren't a 100% match for the truth (except in a series like She-Hulk, which was quite comedic and had No Fourth Wall.) As for Deadpool, even he isn't quite in full Medium Awareness in-universe: rather, he's a Talkative Loon who either thinks he's in a comic book or finds it amusing to act like he does (it's hard to know for sure) and so people just humor him when he starts talking about how he missed his yellow thought bubbles, and how he hasn't seen you since issue five.
Subverted in Superman: Secret Identity, where there are no superheroes, but Superman comics do exist — they're, in fact, the reason Mr. and Mrs. Kent decided to name their perfectly human boy Clark. Then, after being constantly bullied about his nonexistent superpowers, he actually gets them, and the rest of the plot explores the differences between comics and "reality."
Superboy-Prime had a similar origin. His psychopathic behaviour in pursuit of Silver Age values can be at least partly explained by the fact he still thinks of these people as fictional characters.
A Golden AgeSuperman story had Clark taking Lois to the movies... where a Fleischer Brothers Superman cartoon was showing before the main feature. Hilarity Ensues as Clark goes to great lengths to ensure that Lois is distracted every time his on-screen counterpart changes identities. The story ends with Clark and his on-screen counterpart winking at each other, even as he wonders who the Fleischer Brothersare and how they found out all they did.
The Worlds Collide crossover, where the characters of DC Comics met the characters of Milestone Comics, had this since Marvel and DC were both fictional universes within the Milestone Universe. Icon expressed concern that he might not be strong enough to battle Superman, whom he remembered from the original Christopher Reeve Superman film.
In an issue of Batman and the Outsiders, Salah programs Re-Mac with several basic forms, one of them including George Clooney, which amuses Grace Choi and irritates her girlfriend Anissa. This brings up the question if the George Clooney of that universe did indeed star in Batman & Robin, and what Batman himself would make of that.
Similar to the Ultimate Spider-Man example, an issue of Harley and Ivy had the title characters tying up and gagging two actors who were supposed to play Batman and The Joker in a movie. Before being gagged, the man portraying the Joker quoted some lines from The Empire Strikes Back, implying that he was Mark Hamill. The same Mark Hamill who voiced the Joker in Batman: The Animated Series, the show the comic was based on.
While maybe not textbook, Watchmen played with this a little bit. DC Comics, the company that published the book, did once exist, but they stopped publishing after real superheroes emerged. (Of course, since the Minutemen formed in 1940, this would necessarily mean that Batman was published for only one year, and Superman for only two years.) To fill the publication vacuum, comics starring pirates became popular—hence, nobody notices the similarities between characters like Nite Owl and the Blue Beetle or Rorschach and The Question.
The Top 10 universe plays around with this. With so many superheroes, comics about mundane people, such as accountants, are popular.
Runaways mentions The DCU a few times, but it's implied they only exist as TV shows.
Astro City plays with this as well. Comic book publishers can either publish stories of fictional characters like Batman, or secure licensing rights and publish the exploits of real superheroes. Since the heroes are real, authors and publishers are vulnerable to libel lawsnote however, masked testimony is allowed only in criminal cases, not civil ones, greatly limiting the ability of masked heroes to actually bring a lawsuit, and comics are required to adhere to known facts and events.
The story "Where the Action Is" details a comic publisher who publishes embellished exploits of "real life" heroes and villains, with increasingly dangerous results. First, the hero Crackerjack shows up to complain about lack of royalty payments (the publisher puts him off with fast talk and Hollywood Accounting); then, the heroine Nightingale threatens him for insinuating that she and her partner are a lesbian couple (he brazens it out, noting that she'd have to reveal her secret identity in order to sue him). Finally the villain Glowworm corners the publisher at a convention and almost kills him for portraying him as a white supremacist (Glowworm has a radioactive sheen — underneath it, as he puts it, "You know what color I used to be?"). After the last threat, he decides to start a line of "cosmic" (alien/otherworldly) heroes and villains, since they are too above mortal concerns to register complaints. The building gets vaporized one morning several months later.
In his Donald Duck comic stories, Don Rosa prefers to think of Mickey Mouse and other non-Duck cartoon characters as the fictional characters within the fiction, and the Duck characters as the "real" people. This becomes weird when you take into account that Donald was also Mickey's co-star in animation.
DuckTales comics also exist inside his universe. He's mentioned that he likes to think of them as unlicensed fabricated adventures based on the colourful character of the city's biggest celebrity, Scrooge McDuck, and would like to make a comic about him facing the copyright issues involved to prevent the comic's sale, but Disney hasn't at least yet relented to allowing its major animated series to be treated like a pirate release, even inside a comic.
In a case of metafiction meets Real Life, the Disney corporation sued Marvel Comics, stating that the Marvel character Howard the Duck bore too much of a resemblance to Donald Duck, and violated their trademark. Marvel then redesigned future artwork of Howard, changing his overall appearance. But most importantly, Howard would always be drawn wearing pants, apparently because Donald now owned exclusive rights to all depictions of talking duck nudity! In the Marvel comic, Howard would often complain about being forced to wear pants, because he was personally sued by some undisclosed powerful corporation. Due to the Disney/Marvel merger, Howard can presumably go pantsless once again.
Averted (or arguably lampshaded) in the original Worlds Collide crossover between the DCU and the Milestone Universe. The Milestone Universe had Superman comics, so when the Milestone heroes got cosmically shunted to the DCU, they knew Superman's secret identity (and originally assumed he was just some yutz dressed up like Superman). Later on, When Worlds Collide established that the two universes had since merged, presumably wiping out the Milestone heroes' inappropriate memories. Later still, the Milestone Universe became a separate universe in the DC multiverse, though whether they still have Superman comics is currently unknown. Given how the DC multiverse works, it's not out of the question...
Most screen adaptations of Superman's origin — at least those that don't try to incorporate the rest of the DCU as well — act on the assumption that the whole concept of a super-hero does not yet exist in this world, not even in fictional media.
However, in the 1978 Christopher Reeve film, Ned Beatty has a rolled copy of The Mighty Thor in his back pocket.
Prior to the incorporation of the DCU in Smallville, Lex Luthor was an avid collector of comic books, his favorite being a Superhero named Warrior Angel, which started out as vaguely Superman, and then evolved into the Smallville equivalent of Captain Marvel. It also plays with the above statement slightly: Clark might not be the first Superhero, but he has gotten the most attention.
As an in-joke to Robert Downey, Jr. playing the live-action Iron Man role, Iron Man vs Whiplash has Tony Stark check into a hotel and pay an exorbitant amount to not have any questions asked (since he has been accused of a massacre). One of the hotel staff says he knows who Tony really is.. and guesses Robert Downey Jr.
Non-actor version: One Deadpool comic famously features a scene where he incites Wolverine to violence by saying to Kitty Pride "Speaking of games, ever played Street Fighter?" and then Shoryuken-ing her in the face. Then Udon delivered a Shout-Out to that scene in their Street Fighter comic, where Ryu says "Speaking of comics, ever read Deadpool?" and then Shoryukens Sagat.
This carries over to the video game Marvel vs. Capcom 3 which has both Deadpool and Ryu. Not only does he still use the Shoryuken, he explicitly recognizes the Capcom cast as originating from Video Games, stating he loves Street Fighter whenever he fights a charater from those games, among other things (though they never seem to react). Either Deadpool is merely Breaking the Fourth Wall again, or the Capcom characters actually do have video games in the Marvel universe, as the plot involves a scheme between villains of both worlds to merge them into one Earth. No word on whether Marvel comics exist in the Capcom world, however.
X-Force: In a 90's issue, Shatterstar watches Batman: The Animated Series. If anyone decided to cross over into the DC universe, knowledge of the show could pose a huge security risk to Batman.
An issue of G.I. Joe: Special Missions has a child receiving a toy of the Transformer Jetfire. Strangely, Transformers and GI Joe shared the same continuity, and Jetfire even appeared in the GI Joe vs The Transformers miniseries.
An early issue of Grant Morrison's Animal Man run has Buddy listening to R.E.M.'s "Superman" on his Walkman about 10 seconds after having a conversation with Superman himself, making you wonder what the song's lyrics look like in a world where Superman is a well-known celebrity rather than a fictional character.
Howard Wolowitz and his friends from The Big Bang Theory make a cameo appearance in a 2009 issue of Power Girl. One wonders if the gang own that particular comic book...
IDW's Back to the Future mentions that Marty's rival Needles is a big Red Hot Chili Peppers fan. Needles' actor in the movies was Michael "Flea" Balzary, who has been the Chili Peppers' bassist since 1983, leading one to wonder if Needles (or anyone else) ever noticed the resemblance.