Lost in the Cloud: Jake Kasdan, Cameron Diaz and Jason Segel make a comical ‘Sex Tape’

"You don't even have to ask—I'll volunteer that I don't have a sex tape," laughs Jake Kasdan over the phone from California. It's the answer to an unasked question that the 39-year-old writer, director and producer expects to be giving a lot in the near future, considering that the title of his latest film happens to be…Sex Tape.

Opening in theatres on July 25, the R-rated comedy from Sony stars Cameron Diaz and Jason Segel as Annie and Jay, a married couple who decide to put some spice back into their relationship by recording one of their increasingly infrequent lovemaking sessions for posterity. It's a slightly risqué, slightly wild and wholly seductive idea that successfully rekindles the flame between them. Unfortunately, that impromptu recording also threatens to spark a bonfire of trouble when it leaks out into the world, forcing Jay and Annie to race around town over the course of one very long night to keep it away from the hands and eyes of their family (including their two kids), friends and co-workers.

A married man himself—he got hitched to singer/songwriter Inara George in 2008—Kasdan says that he was attracted to the project partly because he recognized the universality of the couples' predicament…the compulsion to make a sex tape more than the "racing around town to keep it from leaking" thing. "Part of what was appealing to me was that within this premise, there was an opportunity to do a big, crazy, funny movie about sex and marriage," he explains. "The movie is really about those things, which are fairly universal subjects and certainly resonated with me personally.”

Kasdan also found common ground in the characters' misadventures with technology—the video only escapes into the wild because Jay accidentally uploads it to that digital Cloud everyone has heard about, but only a few understand. "It's a funny and relatable thing to think that technology is advancing faster than some of us are able keep up with. And what we discovered was that, as more people read the script, the more we started hearing about these kinds of digital accidents. It's the reality of the moment: At times, you feel like your phone and computer are taking over and winning. You're always one software update away from everything going completely to hell."

More than its various thematic resonances, though, Kasdan was first and foremost drawn to Sex Tape because it afforded him the opportunity to reteam Segel and Diaz, whom he had previously brought together for his 2011 hit Bad Teacher, with the latter playing the titular educator and the former playing the gym teacher who digs her despite (or maybe because of) her bad attitude. During production, the director watched delightedly as their onscreen comic and romantic chemistry became, as Kasdan puts it, that movie's "secret weapon.” Not long after Bad Teacher wrapped, Segel brought the Sex Tape script, which was written by The Back-Up Plan scribe Kate Angelo, to Kasdan's attention, but he was initially hesitant to commit. So the actor instead recruited frequent collaborator Nicholas Stoller to help him take a pass at the script with an eye towards directing. Several revisions later, Stoller departed the project to helm the Seth Rogen-vs.-Zac Efron picture Neighbors—this summer's biggest comedy hit so far—and Segel circled back to Kasdan, a friend and colleague since they both launched their careers on the late, lamented TV series “Freaks and Geeks.”

"Jason said, 'Let's take a look at this again,' and I got very excited about it that time. We felt very clearly that it would be a great project for him and Cameron, so we did a little more work on the script and then chased her down and convinced her to do it. We saw an opportunity to do something that was completely different from Bad Teacher; there, the scenes between the two of them were sort of electric in a way you weren't expecting and ended up giving the movie an additional dimension. And here, that electricity is the basis of the movie.”

Sex Tape also represents something of a departure for Diaz in that it's one of the few times she's played a wife and mother in a mainstream studio comedy rather than the bubbly single gal she's often typecast as in films like The Sweetest Thing, Knight and Day and this spring's The Other Woman. And while Segel would seem to have more experience in the "married with children" milieu considering that he recently concluded a nine-season run as family man Marshall Eriksen on the CBS sitcom “How I Met Your Mother,” Kasdan insists that he hasn't played a family man like this before. "Jason's a real take-charge sort of guy and that's a big part of his character in Sex Tape, but not so much present in his typical comic persona. He's also a really fun guy to be around, whereas his previous characters have always been kind of put-upon, because he does that in such a funny way. Here, he's playing a real man with responsibilities who is trying his hardest to take care of his family, but also have a good time in his relationship. It's a completely different comic attitude for him. Cameron's role also draws on what she's actually like in a way that the characters she's played before haven't always. That was certainly true of Bad Teacher, where the fun was watching her play a character that was so far removed from her actual personality. Here, she's an incredibly warm, fun-loving and very strong person and that [reflects] what Cameron is really like."

Like his two stars, Kasdan challenged himself to hit different comic notes as a director with Sex Tape, crafting a movie that was closer to a madcap caper than a premise-driven comedy like Bad Teacher or Walk Hard. "I've never made a movie that's so tightly constructed," he says. "Part of what Jason and I talked about early on is that it should feel like it never stops—even when you show Annie and Jay talking to each other about something, it's happening on the move as they're trying to solve their crisis. It's a fun way to work and ends up dictating a lot about how you make the movie. We had a strong sense of wanting to retain the movie's momentum, which affects the decisions you make about how to shoot it and how to edit it; you have this heightened sensibility about when it comes to a stop, because you don't want that to happen very much. Or, if you do, you want it to happen deliberately and be satisfying, and then pick right up again."

To keep on top of the movie's breakneck pace, Kasdan test-screened it frequently, using the audience's reactions to weed out dead spots. "With a comedy like this that's supposed to be funny every second, you need to hear how it's playing and where the jokes are landing. We also shoot a lot of additional material and extra jokes, so you get to try different things. I actually enjoy the [test-screening] process; it's always stressful and anxiety-ridden, but that's also when you're really shaping the movie."

Given the film's R-rated title, there was little chance of Kasdan delivering a PG-13 version of Sex Tape and the director says that was never a serious option. "We weren't going to do the gentle Sex Tape," he jokes. "We knew it had to have an edge to it—to take big swings and really kind of go for it. It couldn't be sanitized. And these actors are both people who have solid bodies of work in this R-rated comedy genre. When you see that Cameron Diaz is in a movie called Sex Tape, you remember that you've had good experiences with her being funny in other R-rated comedies and you hope this is another one. By the time Bad Teacher came out, it was pretty well-established that the appetite for edgier comedy had returned, thanks to Judd's [Apatow] movies and The Hangover. I’m happy about that, because it jibes with my sensibility, I guess."

Diaz and Segel may be the main attraction in Sex Tape, but like Kasdan's previous films, it boasts a deep bench of supporting comic talent, from Rob Corddry and Ellie Kemper to Nat Faxon and Kumail Nanjiani. Aside from Faxon—a longtime friend who has appeared in every one of the director's movies—the majority of these actors were working with Kasdan for the first time, although he knew them well either personally or by reputation. "Rob had shot a few days on a TV show I was producing, but we'd never really worked together on set even though we had talked about it before. So when it came time to get serious about making this, I said, 'I should just ask Rob to do it,’ and was thrilled when he agreed. With someone like Ellie—who I didn't know as well, but was a really big fan of—it was a matter of deciding it was the right part for her."

Perhaps Kasdan's biggest get was convincing Rob Lowe, an actor who has some direct experience with sex tapes, to play Annie's prospective boss and the person she and Jay least want to view their extracurricular activity. "I wasn't really thinking that much about his own history, although he'd joke about it occasionally," Kasdan chuckles. "Rob just had a brilliant approach for how to play that character. That guy is just really, really funny. It's fascinating because he's had this long, interesting career kind of unlike anyone else. He was the quintessential heartthrob of his generation as a very young guy, his ‘West Wing’ character is one of the great characters from that era of television, and then everyone got to know him for a third time as a legitimate comedy star on shows like ‘Parks and Recreation.’”

With Sex Tape in the can, Kasdan's next assignment is still up in the air. Besides toying with the idea of writing another feature screenplay to direct—his first since Walk Hard back in 2007—he's also got a healthy second career in television, executive producing the Fox comedy “New Girl” as well as developing other series. It's a turnaround from several years ago when, after a particularly frustrating stint working for the small screen, he wrote and directed the hilariously barbed industry satire The TV Set. "It's ironic, I know," says Kasdan, wryly. "I often wonder how it happened that I've been doing this much television in the last few years. Really, I just got involved with a show I love and it's led to some other stuff—that's the short version of what happened! Making a TV show is like being in a band, and it's something that I really enjoy. Sometimes the business side of it I enjoy less, but my second run of TV shows has been a pretty great experience."

But if he returns to the big screen, he already knows that he wants to bring Diaz and Segel back along for the ride. "It's so much fun working with those two. There were times during the course of making both Bad Teacher and Sex Tape where I thought to myself, 'I'm the luckiest director around.’"