Patent application title: COMMERCIALS ON MOBILE DEVICES
Adam L. Berger (Pittsburgh, PA, US)
Adam L. Berger (Pittsburgh, PA, US)
Joshua Pressnell (Dayton, OH, US)
Richard David Jackson (Curitiba, BR)
Penthera Partners, Inc.
IPC8 Class: AH04N2181FI
Class name: Interactive video distribution systems program, message, or commercial insertion or substitution
Publication date: 2015-03-12
Patent application number: 20150074709
Among other things, a video item is downloaded to a mobile device from a
digital video recorder. The video item includes a video program and
commercials that have been previously embedded within the video item.
Before, during, or after the download of the video item, information is
reported from the mobile device to a server about the video item, from
which the server can select a set of substitute commercials. One or more
of these substitute commercials are downloaded from the server. When the
video item is presented on the mobile device, the mobile device replaces
at least one of the original commercials that has been previously
embedded within the video item by a substitute commercial that has been
downloaded to the mobile device.
25. The method of claim 36 in which the information reported about the presentation of the original commercial of the substitute commercial includes the time when the commercial was presented.
26. The method of claim 36 in which the substitute commercial is of higher value than the embedded commercial.
27. The method of claim 36 in which the predetermined condition comprises the sufficiency of a number of downloaded commercials that are stored in the storage of the mobile device.
28. The method of claim 36 in which the downloading of the video item that occurs automatically, without requiring any explicit action by a user of the mobile device.
29. The method of claim 36 in which the predetermined condition comprises whether a predetermined period of time has elapsed after the video item had been recorded on the digital video recorder.
30. The method of claim 29 in which the period of time is based on a value of the commercial during the period of time.
31. The method of claim 36 comprising maintaining the substitute commercial in a cache at the mobile device.
32. The method of claim 36 in which the predetermined condition comprises a location of the mobile device.
33. The method of claim 36 in which the predetermined condition, comprises a representation of the timeliness of the embedded commercial.
34. The method of claim 36 in which the digital video recorder comprises a conventional digital video recorder.
35. The method of claim 36 in which the digital video recorder comprises a cloud digital video recorder.
36. A method comprising presenting from a storage of a mobile device a video item that was downloaded at the mobile device from a digital video recorder, the video item including a video program and at least one commercial within the video item, the downloading complying with a rule governing when downloading is permitted, the rule permitting downloading only when a WiFi connection is available, the mobile device replacing at least one of the commercials within the video item with a substitute commercial, depending on a predetermined condition, at the time the video is presented, the mobile device obtaining the substitute commercial from storage of the mobile device. the mobile device reporting information about the time of the presentation of the substitute commercial to the first server or another server when the mobile device has adequate connectivity, the mobile device sending information about the download of the video item to the digital video recorder.
 This application is related to U.S. provisional patent application
61/828,481, filed on May 29, 2013, to non-provisional patent application
Ser. No. 13/923,103, filed on Jun. 20, 2013, and to U.S. non-provisional
patent application Ser. No. 14/016,963, filed Sep. 3, 2013, the entire
contents of all of which are incorporated here by reference.
 This description relates to commercials on mobile devices.
 In general, in an aspect, a video item is downloaded to a mobile device from a digital video recorder. The video item includes a video program and commercials that have been previously embedded within the video item. Before, during, or after the download of the video item, information is reported from the mobile device to a server about the video item, from which the server can select a set of substitute commercials. One or more of these substitute commercials are downloaded from the server. When the video item is presented on the mobile device, the mobile device replaces at least one of the original commercials that has been previously embedded within the video item by a substitute commercial that has been downloaded to the mobile device.
 Implementations may include one or a combination of any two or more of the following features. The downloading from a digital video recorder is from a cloud-based digital video recorder comprising storage that is remote from the device. The downloading from a digital video recorder is from a conventional digital video recorder comprising storage that is contained within the device. Information is acquired about the beginning time and the ending time of each of the original commercials within the video item. Information is acquired about the beginning time and the ending time of each original commercial by algorithmically analyzing the video item. Information about the beginning time and the ending time is acquired by the DVR. Information about the beginning time and the ending time is acquired at the mobile device. If the video item is presented on the mobile device within a predetermined period of time after the video item was recorded on the DVR, the mobile device refrains from replacing at least one of the commercials that has been previously embedded within the video item with one of the substitute commercials. The period of time is based on a value of the commercial during the period of time. The substitute commercials are of higher value than the commercials for which they are substituted. The substitute commercials are maintained in a cache at the mobile device. The downloading is initiated by the user of the mobile device. The downloading occurs automatically, with no explicit action by the user of the mobile device.
 In general, in an aspect, at a digital video recorder, in response to a request from a mobile device, downloading a video item to the mobile device. The video item includes a video program and commercials that have been previously embedded within the video item. Substitute commercials are downloaded to the mobile device for inclusion in the video item in place of the commercials that had been previously embedded.
 Implementations may include one or a combination of any two or more of the following features. The digital video recorder includes a cloud-based digital video recorder. The digital video recorder includes a local digital video recorder.
 In general, in an aspect, based on a request of a user, a video item is downloaded to a mobile device from a cloud-based or local digital video recorder. The video item includes a video program and commercials that have been previously embedded within the video item. Information is reported from the mobile device to a server about the video item from which appropriate commercials can be inferred. The video item is algorithmically analyzed to acquire information about the beginning time and the ending time of each of the commercials within the video item. One or more substitute commercials are downloaded that have been selected based on the information about the video item to a server. The commercials are stored in a cache on the mobile device. When the video item is presented on the mobile device, the mobile device substitutes for at least one of the commercials that has been previously embedded within the video item, a substitute commercial that has been downloaded to the mobile device and stored in the cache.
 In general, in an aspect, when playout of a video item at a mobile device reaches a point at which a commercial is to be inserted, the mobile device obtains a fresh commercial from a server and plays out the fresh commercial.
 Implementations may include one or a combination of any two or more of the following features. The fresh commercial is downloaded from the server and played out. Playback of the fresh commercial is begun before the entire commercial has been obtained. The fresh commercial is played out in place of a commercial held in memory of the mobile device.
 Other aspects, features, and implementations and combinations of them can be expressed as methods, apparatus, systems, components, methods of doing business, program programs, means and steps for performing functions, and in other ways.
 Other aspects, features, and implementations will become apparent from the following description and from the claims.
 FIGS. 1 through 8 and FIG. 15 are block diagrams.
 FIGS. 9 through 14 are screen shots.
 FIGS. 16, 17, and 18 are flow diagrams.
 FIG. 19 is a block diagram.
 FIGS. 20, 21, and 22 are flow diagrams.
 FIG. 23 is a schematic flow diagram.
 FIG. 24 is a screenshot.
 In the following description, we use the term "app" or "application" or "mobile app" broadly to include, for example, an executable binary that is installed and runs on a mobile device, or a web site that the user navigates to within a web browser on the mobile device, or a combination of them. An "app" may also refer to multiple executable binaries that work in conjunction on a mobile device to perform one or more functions; for example, an Android service and an Android application that communicate with one another.
 We use the term "app" in the context of video broadly to include, for example, any software, hardware, firmware, or combination of them that is able to access, accept, process, or play a video that is downloaded on or streamed to the mobile device. We use the term "system" broadly to include, for example, any set of components or facilities--mobile app, streaming video server, content delivery network, and possibly other elements, for example--that together comprise or provide or support a service that delivers video to devices and plays them for users of the devices. We use the term "streaming" broadly to include, for example, a service that allows a user to view a video on a device as the video is being delivered to the device, and in which the entire video is typically not stored persistently on the device. We use the term "mobile devices" broadly to include, for example, any portable device, such as a cellular-enabled phone, a tablet, or a laptop, that is capable of receiving a video stream over a wireless network and playing the video stream as it is received. We use the term "playing" broadly to include, for example, presenting the video on the mobile device for viewing by the user. We sometimes use the terms "playback" or "playout" interchangeably with "playing." We use the term "wireless networks" broadly to include, for example, 3G, 4G, LTE, 802.11 (also known as "WiFi"), Bluetooth, and other well-known protocols for wireless data delivery. We use the term "online" broadly to include, for example, having access to a network connection; and the term "offline" broadly to include, for example, not having access to a network connection.
 We use the term "streaming video server" broadly to include, for example, any server accessible to the mobile device over a network connection and capable of delivering streaming video, for example, in conformity with Microsoft Smooth, Apple HLS, or other standard video-streaming protocols. We use the term "recommendation engine" broadly to include, for example, a system that uses historical data to identify items of potential interest to a user. We use the term "analytics server" broadly to include, for example, any server accessible to the mobile device over a network connection and capable of one or more of the following functions: receiving one or more files from a mobile device containing past activity on the device, persisting this information, aggregating this information with similar information received from other devices, and generating a graphical or tabular representation of this collected information.
 Streaming video to a mobile device has become a mature and popular technology. Pay-TV distributors (e.g., Comcast, Time Warner Cable, Charter, Cox), TV networks (e.g., HBO, ABC, AMC), and various Internet-based services (e.g., Amazon, Netflix, YouTube) each offer services that stream video over IP networks to mobile devices.
 Typically, so-called video streaming over IP relies on one of two common Internet communication standards: TCP and UDP, each a protocol for delivering data from one machine on the Internet to another machine. Video streaming over IP can be performed in unicast mode, (i.e., one source delivering video to one receiver). In some cases, video streaming over IP can be performed in broadcast or multicast mode (i.e., one source transmitting to multiple receivers).
 In conjunction with TCP or UDP, streaming video services typically rely on enabling technologies such as video-encoding protocols (e.g., Apple's HLS format and Microsoft's Smooth format) that are designed for streaming video. These protocols allow the user to experience smooth playout of the video even as network conditions deteriorate or improve during playout. These protocols also allow for a minimal delay between the user's request for the video and the start of video playout. From a mobile device, a user may access streaming video that has been encoded by one of the protocols, using a web browser like Safari or Chrome running on the mobile device. A user may also access streaming video using an application installed and running on the mobile device, such as Hulu Plus, Netflix, HBOGO, or SkyGo.
 In some cases, the streamed videos may be "premium" content (e.g., HBO), access to which requires, for example, a monthly subscription fee. Such premium content typically includes few or no commercials (we typically use the terms ads, advertisements, and commercials interchangeably). In some cases, the streamed videos may originate from ad-supported networks (e.g., ABC, AMC, Fox), in which case the video may include commercials before, during, and after playout, or any combination of two or more of those.
 A streaming video service may offer VOD (video-on-demand) or live TV, or both. By VOD, we mean a video service that offers a catalog of videos from which the user may select and view an item. Each of the videos in a VOD catalog was created at some time in the past; therefore at the time when a video is being played, the entire video is already in existence. In contrast, a live TV service offers a group of video streams each of which is being created in real time during streaming. Therefore, at the time when a current portion of a live video stream is being played, later portions of the same video stream are being created. In that sense, a live TV video is incomplete during the time when it is being played.
 The general idea of managing the selection and insertion of commercials into streaming video is not new. Products that do so include Adobe Auditude, Freewheel, and BlackArrow.
 Recently, some companies have begun to introduce a video download feature as a new feature in their streaming products. Some companies have introduced exclusively video-download products, i.e., products that offer download but not streaming. In either case, video-download is a feature that allows users to download a video from a network data repository to a mobile device. Two examples of the former download-enabled services are Comcast's Xfinity Player and BSkyB's SkyGo Extra app.
 We use the term "download" broadly to include, for example, any delivery of a video item in its entirety to a persistent non-volatile storage of a mobile device. In download, the recipient device stores the video persistently and can, for example, play out the video long after (e.g., minutes, days, weeks or longer) the delivery. The video item may consist of one file or of multiple files. The video item that is downloaded may be a VOD item or a live stream. In some cases, the mobile device may initiate the download process by, for example, transmitting an HTTP `GET` request to a remote server that stores the object to be downloaded. In some cases, the mobile device may use a protocol, such as FTP, to fetch the video item from the remote source.
 We use the term "non-volatile storage" or "persistent storage" broadly to include, for example, any technology such as magnetic disk drive or solid-state memory that retains stored data, for example, even while the device is powered off. Storing a video in the device's non-volatile storage means or storing it persistently that the stored video will remain on the device until the user or another application deletes the video. We use the term "data repository" broadly to include, for example, any storage mechanism that can deliver data to the requesting devices over a network connection. Within the context of video download, a "mobile device" is normally capable of storing the downloaded video on the device for later playout.
 Among the advantages of a video-download feature are that a user can download a video from, for example, a VOD catalog when the user has access to a network connection, and the user is able to play the video later, when he or she does not have (or adequate) access to any network connection. For example, a user can download a TV show or movie to her mobile device while she is at home, before leaving for the airport. Later, while she is in an airplane, she can play out the downloaded video, even though she has limited or no Internet connectivity in the airplane.
 An advantage of a video-download feature is that users can consume high-quality videos from a VOD catalog even if the user only has access to a low-quality network connection. For example, imagine the user wants to view on her mobile device a 10-minute video, which has been encoded in three formats: low quality (0.3 Mb/s), medium quality (0.8 Mb/s) and high-quality (1.8 Mb/s). Say the user has a 0.6 Mb/s network connection. Over this network connection, she can only stream the low-quality (0.3 Mb/s) version of the video. Attempting to stream the medium- or high-quality version of the video would fail, since the network connection cannot support the required data throughput. However, she can download the high-quality version of the video, even over the 0.6 Mb/s network connection. Over this network connection, the download would require about 30 minutes. Once downloaded, the high-quality video is available at the mobile device for the user to play out. Thus, using download, a user can play out a high-quality video, even lacking a corresponding high-throughput network connection.
 An advantage of a video-download feature is time-shifting from a time when a live TV show is being shown, for example, a rugby game scheduled for noon GMT, which is 4 AM Pacific Time, to a later time that is convenient for a rugby fan living in California. To do this, the fan can set his mobile device to record the show at 4 AM, and then the fan can watch the saved show at, e.g., 10 AM local time.
 An advantage of a video-download feature is in reducing the use of expensive network connections. Typically, wireless operators like Verizon Wireless impose a monthly limit on cellular data usage, e.g., 2 GB per billing cycle, and impose an "overage" charge for data usage exceeding that limit in a given billing cycle. For instance, in mid 2013, the network operator Verizon Wireless assesses a $15 overage fee per GB used above the subscriber's limit in any one billing cycle. A Verizon Wireless subscriber with a 2 GB quota can stream about 5.5 hours of 800 Kb/s video in a given billing cycle over the Verizon network, before overage charges apply. In other words, this Verizon Wireless subscriber is limited to about 5.5 hours of streaming video over the Verizon Wireless network until overage charges apply. A benefit of download is that Verizon Wireless subscribers who can plan ahead (and who have access to a download product) can download one or more videos in advance using a WiFi connection (e.g., at home or in their office), and subsequently watch these videos at a time and place where WiFi connectivity isn't available, thus avoid the risk of an expensive overage charge. In other words, download enables "wireless-mode shifting" that reduces one's cellular data consumption without reducing one's overall video consumption.
 A system that supports the downloading of videos to a mobile device may have some or all of the following features:
 Using a mobile app or another tool (e.g., a web site, email, text messaging, or a TV set top box), the user may select a movie, an episode of a TV show, a live TV channel, or another video item and request that the video item be downloaded to the user's mobile device.
 Using a mobile app or another tool (e.g., a web site, email, text messaging, or a TV set top box), the user may select an episodic program (e.g., a weekly TV series, podcast, or radio program) and request that some or all new episodes of the series be automatically downloaded to the device as they become available.
 Using a mobile app or another tool (e.g., a web site, email, text messaging, or a TV set top box), the user may select an episodic program (e.g., a weekly TV series, podcast, or radio program) and request that some or all old episodes of the series be automatically downloaded to the device.
 The user may delete downloaded video items, one at a time or several at a time, from the mobile device.
 The system may automatically delete certain video items (e.g., older items, or items already viewed) to make room for new ones.
 The mobile app may transmit information related to its past activity (e.g. which video items it downloaded and when) to an analytics server.
 The system may employ a recommendation engine to identify videos that are of likely interest to the user, based on other videos the user has played and/or websites the user has visited, or other actions the users has taken. The recommendation engine may also rely on known behaviors of the user's friends (on social networks such as Facebook) to identify videos of likely interest. The system may automatically download these videos to the user's device.
 The mobile device may query a remote server automatically, recurrently, for the existence of one or more new videos that the user has subscribed to, or that the recommendation engine has selected for delivery to the device. Instead or in conjunction with such queries, a remote server may trigger the mobile device to initiate the download by transmitting a signal to the mobile device. Server-initiated signaling protocols include, for instance, APN (Apple Push Notification) for Apple mobile devices and GCM (Google Cloud Messaging) for Android devices.
 The user may view the status of currently-downloading videos and videos that are queued for download. The status may include, for example, the number of bytes downloaded and the number of bytes pending download, the percentage completed, the estimated time until download completion, and the number of videos to be downloaded in advance of a given video. We use the phrase "queued for downloading" to include, for example, scheduled to be downloaded to the mobile device but not yet completely downloaded to the device.
 The system may download to the mobile device metadata along with the video item. Metadata may include, for example, a title, description, parental rating, closed-captioning, and an image corresponding to the video item.
 The system may enforce time windowing on the downloaded video item. We use the term "time windowing" broadly to include, for example, any controlling of the times or time period during which a downloaded video item may or may not be played, e.g., a date after which (or before which or both) the video item is automatically made unplayable. At the time of forced expiry (the end of the time window), for example, the stored video item may be rendered unplayable or may be deleted from the device. Digital rights management (DRM) technologies, such as available from Adobe, Microsoft, SecureMedia, and Widevine, are one mechanism for enforcing the unplayability of a video based on the time windowing.
 The system may perform downloading in the background. We use the term "in the background" to include, for example, any process that begins without requiring intervention by a user and/or that proceeds without notifying the user of the download's start, progress, or completion. For example, a user can specify that they want to download all new episodes of a TV show. The app can then download to the device all new episodes of the TV show, as the episodes become available. The user need not explicitly initiate or even be aware that a particular item is downloading. As another example, the app may automatically select video items that are likely to be of interest to the user (based, for instance, on other video items the user has recently viewed) and automatically download these items to the user's device; again in this case, the user need not explicitly initiate or request for a specific video item to download.
 The user may receive an alert or "notification" by email, text message, or a visual or audible indicator on the mobile device, to indicate, for example, that the video has been successfully downloaded in full to the device and is now available for playout. (We sometimes use the word video interchangeably with the phrase video item.)
 The system may perform downloading according to a set of rules that govern when downloading is permitted. For example, only when the device has more than 500 MB of free space, only when the device has more than 75% battery charge, or only when the device has a WiFi connection, or some combination of and two of these and other rules.
 The system may download video items from a remote server on the public Internet, using standard protocols such as HTTP, TCP, and/or UDP.
 The system may download video items from another device, such as a smartphone, tablet, PC, game console, or conventional digital video recorder (DVR). In each case, the source device (from which the video items are downloaded) contains a magnetic disk drive, solid-state memory, or other persistent storage device where video items are stored.
 The system may download video items from a network or "Cloud" digital video recorder, which is a DVR in which the video items are stored not on the DVR itself, but on a remote network server.
 The downloading may occur through some combination of broadband networks, WiFi, and Bluetooth. In some cases, the downloading may occur through a cable that attaches the source device to the target device.
 The system may allow the user to configure some or all aspects of the behavior listed above.
 FIG. 9 illustrates a mobile device screen shot for an example VOD download system. The app presents the user a list or gallery 290 of videos that can be selected for downloading. The gallery may be grouped into broad categories 298, such as Classic TV. Listed items may display the title's name 300, cover art 302, and genre 304. Selecting an item may bring up an additional screen, FIG. 11, with further description of the title 306, runtime and video size information 308, and the option to stream the video now 310 ("Watch Now") or download the video for later viewing 312.
 As shown in FIG. 12, the app can also present to the user a view of videos 384 that have been downloaded 386, or are in the process of being downloading 388, or are queued for download or may present any combination of those. These are videos that the user has explicitly requested to download, episodes of a series that the user has subscribed to, or videos that some other system element (for example, a recommendation engine) has elected to deliver to the device, for example. This view may be interactive: the user can see the progress 292 of pending downloads, and play 294 or delete 296 any of the fully-downloaded videos. The user may be able to pause, resume, and cancel a single or two or more queued downloads, or all queued downloads. Invoking the edit button in the upper right-hand corner of the screen brings up a menu that enables the user to delete downloaded items.
Online Video Advertising
 Technology for managing, inserting, displaying, and measuring the viewing of commercials within streaming video is commonplace. Companies like Adobe, Freewheel, and BlackArrow have products that manage the selection and insertion of commercials into streaming video, and record when a commercial is presented for viewing. We use the term "measuring" broadly to include, for example, any tracking, observing, quantifying, recording, or generation of metrics that relate to display, performance, or presentation to a user and activities of the user associated with an commercial, for instance, recording whether a user triggers an interactive prompt displayed during the commercial (such as a pop-up that when clicked brings the user to a webpage for more information), or whether a user exits the video application instead of watching the commercial. We use the term "ad server" broadly to include, for example, any server that selects and delivers advertisements for placement into any kind of Internet-delivered content, such as web pages, audio, and video, or combinations of them.
 The Internet Advertising Bureau (IAB), an industry consortium, has published a specification for the delivery and playout of ads within streaming video, called the Digital Video Ad Serving Template (VAST) (reference: http://www.iab.net/vast). Commercials may be of different types, including linear, companion ads, ad pods, and so on. The VAST specification describes the different types and is incorporated here by reference in its entirety. To simplify the discussion, we will focus on linear ads, but the techniques and systems that we describe here apply to the other ad types.
 For background and as shown in FIGS. 1 and 2, we now present an example of the placement, delivery, and consumption of commercials within streaming video. For simplicity, this description omits some elements of the workflow, such as authentication, entitlement-checking, and the (often several) layers of redirection between the app and the ad server.
 1 USER LAUNCHES APP 8: On a mobile device 54, a user 10 launches 8 an app 12. The app has been installed onto the mobile device prior to launch. The user selects 13 a video item 14 from a catalog 16 of video content 18 that is presented to the user by the app through a user interface 19 of the mobile device. The catalog presents to the user the video content that is available to the user and may consist of all or a subset of the overall inventory 18 of video content. The catalog may be stored on the mobile device and may update its listing of available videos based on communication with the inventory of video content 18. The catalog updates could occur according to a schedule or when the user launches the app or a combination of the two. The catalog may also be stored in a network data repository. In some cases, the user may select a channel from a menu of live TV channels.
 2 APP REQUESTS VIDEO 20: After the user selects a video from the VOD catalog or a channel from the menu of live TV channels, the app initiates a request 22 to a streaming video server 24 for the selected item. At a minimum, the app request should contain information sufficient to identify the item selected by the user, such as the item's title, or some other unique item identifier that allows the streaming video server to identify the requested item from its inventory of videos. The request may contain a variety of other information, including information related to the mobile device, such as a list of supported video protocols, the screen size and supported video, and the number of supported audio channels. The request may contain identifying information about the user, which allows the system to validate that the user is authorized to access the selected item. The request may further contain preference information related to start-up time for the stream, tolerance for buffering during stream playout, and limits on data size of the stream. The app may indicate to the user that the request has been sent to the streaming video server or may indicate to the user that the request has not been made successfully only if an error occurs.
 3 STREAMING SERVER SELECTS VIDEO VERSION: The streaming video server may maintain several different versions or "profiles" 31 of a given video 14, corresponding to different encoding qualities, for example, each appropriate for a particular range of network capabilities and particular device screen resolutions. For a given device request 22, the streaming video server selects 32 one version of the video item.
 4 STREAMING SERVER PREPARES METADATA: The streaming video server will select and/or create a file or set of files containing metadata 34 corresponding to the video. This metadata may include, for example, a description of the video, closed-caption text for the video, a production date for the video, and "ad insertion points" 59. We use the term "ad insertion points" broadly to include, for example, any indication of where in a video an ad may be or must be inserted, for example, directives on the frames or times at which to insert commercials into the video.
 5 AD SERVER SELECTS COMMERCIALS: The ad server 390 maintains an inventory 52 of commercials. The ad server stores the video commercials themselves, or instead, the ad server may only store links or pointers 392 to the commercials, which may be stored in other locations 394. The ad server associates a set of metadata 57 with each individual commercial in this inventory. The commercials themselves and the associated metadata may be supplied, for example, by the advertisers themselves (e.g. Lexus, Capital One or Walmart), or by an agency representing the advertiser (e.g. WPP, Omnicom, Publicis, Group M). Using a selection algorithm 51, the ad server chooses 47 (in FIG. 2, the location of the ad selection in the sequence of actions need not be as shown) a set of commercials 53 from this full inventory 52 of commercials. The number of selected commercials 53 will typically be equal to the number of insertion points in the video. We describe this commercial-selection process below in more detail.
 6 SERVER INITIATES DELIVERY 30: The streaming video server begins streaming 30 the video to the device. The video may be delivered using the HTTP protocol, using a technology like progressive download or HTTP Live Streaming (HLS). Before or during this step, the streaming video server or ad server will also deliver 33 to the mobile device a set of links to the selected commercials. Each link may be, for instance, a URL (uniform resource locator or "web link") to a video file containing the commercial. The set of links may be in the form of an XML file which contains the URLs for the commercials, plus the insertion point for each commercial in the video item (i.e. a time offset, expressed in milliseconds, from the beginning of the video item).
 7 APP INITIATES PLAYOUT 40: Some time after it has begun to receive the streaming video, referred to as the start-up time, the app on the mobile device commences playout to the user. It is typically not necessary for the streaming of the video to have been completed before playout commences.
 8 APP SUSPENDS PLAYOUT 44: After a period of playout guided by the first insertion point previously delivered to the app, the app suspends playout of the video item.
 9 APP PLAYS COMMERCIAL 70: The app plays one of the commercials previously delivered to the app. To play the commercial, the app may first open a network connection to a separate video server, which delivers the commercial to the app using a communication protocol such as UDP or TCP.
 10 APP EXECUTES BEACON 72: The app may execute a tracking beacon 74 before, during, or after the commercial is played, or any combination of two or more of those times. A tracking beacon is essentially a network call 81 to a remote tracking server 80, which records that the commercial is about to be played, is in the middle of playout, or has completed playout on the mobile device. The tracking server 80 may be the same as the analytic server 80 or ad selection server 390, or it may be a different server. The data recorded by the tracking server may be provided later to the advertisers as verification that their commercials have been viewed by users.
 11 APP LAUNCHES INTERACTIVE ELEMENT 84: In some cases, the user may perform an action through the user interface of the device (e.g., press a key 86 or tap on the screen 88) during playout of the commercial. Doing so may cause the app to stop playout and launch the device web browser 90 using the URL 91 of the advertiser 92 as the page to launch first. Instead of launching the device web browser, the app may instead display advertiser's content, contained in the commercial's metadata, through the app itself.
 12 APP RESUMES COMMERCIAL PLAYOUT 85: If playout of the commercial is stopped during user interaction, the app may keep track of the commercial's progress so that the app can resume playout from that point of the commercial when the user is done with the interactive element. The app may forego resuming the commercial and instead resume the video (that triggered the ad) from the insertion point. The app may continue to play the commercial as a background (for example, dimmed) element of the user interface while the user interacts with the interactive element. The behavior of a commercial during user interaction with an interactive element 340 may be controlled by that commercial's metadata 342. Before launching the web page or in-app content of the advertiser, the app may prompt the user 94 to confirm 346 her intent (See FIG. 10). The user may view the web page or in-app content. When the user is finished, she can close this view and return to video playout.
 The actions illustrated in FIG. 2 need not take place in the exact sequence shown, some of the actions need not occur at all, and other actions not shown may be part of the sequence.
 When an app initiates a request for a video item, the ad server will select a corresponding group of commercials, among its inventory of commercials, for insertion into the video item during playout. The selection process can rely on one or combinations of any two or more of the following factors, among others:
 when the commercial becomes active or expires or both: A commercial's metadata may specify that it may be played only after a particular "start window," or not after a later "expiry window," or both. For example, a retailer may purchase 100,000 impressions of a commercial for an upcoming President's Day sale, but not before 3 days prior to the sale, and not after 6 PM on the day of the sale. For another example, an advertiser may license a song from a musician for two weeks, after which time the advertiser no longer has the right to present the commercial with that music. The ad server will only select ads whose start window has passed but whose expiry window has not yet occurred.
 the kinds of video items (or specific videos or series) into which a commercial may be inserted: An advertiser may negotiate the right to insert its commercial inside a certain set of video content, and to exclude its commercial from other video content. For example, an advertiser may wish to display its commercial inside sports-related videos, but not reality shows. We will call the former the "allowable" videos for that advertiser. The commercial's metadata may express this constraint. An ad server will only select a commercial if the video item is allowable for that commercial.
 the number of overall impressions (views): Advertisers typically purchase a fixed number of "impressions" for a commercial. We use the term impressions broadly to include, for example, the number of times a commercial was inserted into the video and the user either watched the commercial to completion (allowed it to play through without exiting out of the app) or triggered an interactive element from the commercial or a combination of the two. The commercial's metadata may express this information in some manner. The ad server may use the number of remaining (paid-for but unfulfilled) impressions as a selection criterion.
 the specified sequence of commercials: An advertiser may require that a series of related ads be viewed in a particular sequence. For example, a car manufacturer may wish to present to each viewer a sequence of ads: first a superficial product "teaser" showing the exterior of the car in motion, then a more revealing description of car's interior, and finally, pricing and local dealer information. A commercial's metadata may include whether the commercial is part of a sequence, uniquely identify that sequence, and also indicate the commercial's place within that sequence. By using selection criteria that respect sequence ordering, commercials in a sequence may be inserted into a video at their proper order.
 demographic information about the user: The ad server may employ in its selection criteria the location of the user (e.g., a GPS location or a coarser metric such as the city/state), the make and model of mobile device (e.g. Apple iPad 3), and, where available, any other personally-identifiable information such as age and gender.
 The idea of delivering ads to mobile devices for later presentation is not new. Companies that have done so include Goldspot (http://gigaom.com/2010/03/05/goldspot-delivers-mobile-ads-while-you-slee- p/) and Transpera (which delivered to mobile phones video ads inserted into web pages displayed on the mobile phone).
 Here we describe a system that, among other things, handles the insertion, measurement, and interactivity at the mobile device, during the playing or videos and while the device is not connected to a network.
 As shown in FIG. 3, consider an app 101 installed on a mobile device 102; the app (when the mobile device is online, as shown on the left side of the figure) supports downloading 103 videos 105 from a server 104 for later playback (when the mobile device is offline, as shown on the right side of the figure). Each downloaded video is stored on the device's non-volatile storage 111. In some cases, once the videos are downloaded, the user 107 may initiate playback 109 of a previously-downloaded video while the mobile device is offline.
 The system and techniques that we describe here are designed to support download and offline playout of ad-supported videos, among other things.
 Some key features include:
 1. OFFLINE CACHE OF COMMERCIALS: The system maintains an offline cache of commercials on the mobile device at all times. These commercials are delivered to the device and saved in the device's non-volatile storage, so that if the user plays out a downloaded video while the device is offline (or in some examples, when the device is online), downloaded commercials will be available for playout before, during, and after playout of the video. We use the term "offline cache" broadly to include for example, any kind of non-volatile storage space on the device that is allocated for commercial video and ad storage and over which the user generally has no file-level control (such as playing and deleting videos). The user may have the ability to configure the size of the offline cache. In some examples, the cache may be implemented using dedicated non-volatile memory on the device. In some cases, the cache may be implemented in software at the app or OS level, using general user storage space.
 2. SELECTION FROM OFFLINE CACHE: During offline video playout of a downloaded video, at every ad-insertion point (before, during, or after the playout of the video), the app may select a commercial from the offline cache of downloaded commercials and play the commercial, without having to contact any remote server, including the ad server. In some cases, even during playout of downloaded video while the device is online, the app may still rely on the offline cache of downloaded commercials. FIG. 18 shows the parallel workflows for ad selection when the device is online and offline If the device is online, the device context the ad server for ads and plays the downloaded video with ads streamed from the server. Tracking beacons are executed in real-time. If the device is offline, ads are selected from the local ad cache, the downloaded video is played with selected downloaded ads inserted, and tracking beacons are stored for later playback when the device is again online.
 3. RECORDING OF OFFLINE PLAYOUT: During offline video playout, the system records the identity of each played commercial, as well as the time of playout, the location of playout, the identity of the video, and the insertion point within the video. This information is saved on the mobile device, and transmitted from the mobile device to a remote server when the device's network connectivity is restored. In some implementations, other kinds of information could also be recorded, saved, and transmitted with respect to played commercials.
 4. INTERACTIVITY WHILE OFFLINE: Commercials on mobile devices often include interactive elements that enable users to perform actions or cause actions to occur. During offline video playout, if the app plays out a commercial that includes an interactive element, the app will record if the user performed an action, for example, indicated (for example by tapping on the device screen) that the user wanted more information about the advertiser. The app will later, once network connectivity is restored, cause corresponding actions to occur, for example, by providing the user the ability to access the requested information (e.g., a web site).
 Important functions of the system include: selecting commercials; downloading commercials from a server; ensuring the device has access to a sufficient number of commercials; providing access to commercials; refreshing the cache of commercials on the device; recording viewings by users of commercials; and enabling interactivity associated with the viewing of the videos or commercials; and combinations of any two or more of those functions and others.
 We cover each of a number of these aspects in turn.
 We refer to FIG. 4, which is somewhat similar to FIG. 1. An important difference is that in FIG. 4, the mobile device 201 now includes an offline cache 202 of commercials 205. The offline cache also stores metadata 207 for each commercial. The device also includes a local ad engine 203 that executes a selection algorithm 204 to choose commercials from the offline cache 202, using the metadata 207.
 In the streaming scenario, selecting commercials is entirely the responsibility of the ad server; typically, no element on the mobile device (including the app) has any responsibility for selecting commercials.
 The system and techniques that we describe here change this approach to support offline playout of downloaded videos and commercials in a number of ways including one or more of the following and combinations of any two or more of them:
 When the app downloads a video, it contacts the ad server to request a set of corresponding commercials. The ad server performs a selection algorithm to identify a group of commercials, just as described above in the streaming scenario ("AD SERVER SELECTS COMMERCIALS"). In this case, the app downloads the selected commercials for later playout.
 When the system downloads 210 a commercial 212 to the mobile device and stores it 218, the system also downloads a set of metadata 224. The local ad engine 204 uses this metadata to help guide its selection 226 of one or more commercials from among the locally-stored commercials.
 In some cases, the metadata may can be embedded in the commercials and therefore necessarily downloaded with them. In some implementations, the metadata can be stored and delivered separately and associated with the commercials. Any of a wide variety of arrangements can be used to associate the metadata with the commercials. Some metadata can be associated with more than one commercial; in some other cases, each commercial has its own metadata, not shared with other commercials.
 A wide variety of fields of metadata can be defined and used, including:
 A `use-by` field 228: the date or time after which the commercial must be disabled or deleted from the device cache. We sometimes refer to the `use-by` value as the expiry of the commercial.
 A `use-after` field 229: defines the start date or time for use of a commercial.
 A `use-against` field 230: specifies the allowable video content, specific videos, or kinds of videos or video series that this commercial may be inserted into.
 A `max-impressions` field 232: specifies the maximum number of times this commercial should be shown on this device.
 A `use-nearby` field: specifies that the commercial should only be shown when the mobile device is within a certain distance from a geographical marker (e.g. within 20 miles of Cleveland, Ohio or within 800 meters of Joe's Clam Shack on Hilton Head Island, S.C.).
 Other metadata delivered with the commercial could include, for example, information that instructs the app to show the commercials in a certain sequence. Any combination of two or more such fields, and other fields, can constitute the metadata for a commercial.
 In some implementations, for efficiency in transmitting the metadata from the ad server to the mobile device and storing the metadata on the mobile device, the amount and the fields of metadata that is downloaded to and stored on the mobile device are smaller or fewer than the amount of metadata and the fields stored on the server in scenarios such as the ones described earlier. In such implementations, we call this set of metadata delivered to and stored on the app a "reduced set of metadata". We refer to this set as reduced in that it may and typically is a set of less metadata than the set 57 shown in FIG. 1 used by a remote server to select commercials. In some cases, it is possible to send more metadata to the mobile device than can be stored there and to have the mobile device store only a subset of what is downloaded. In some cases, different mobile devices that have different storage capacities could receive the same sets of metadata and reduce those sets to different subsets to be stored locally. The metadata may be delivered with the related commercial but also could in some implementations be delivered separately or a combination of the delivery techniques could be used
 Prior to or during playout of a video, the local ad engine 204 consults this metadata to select from among the cached commercials those to be inserted into the video, or before or after the video.
 As shown in FIG. 6, the ad server selects, from a universe of all commercials 260 available at the ad server a group of commercials to download 262 to the mobile device. From among the downloaded commercials, one is selected 264 for playout at any given insertion point in a video.
 In making its selection of commercials, the ad server may take into account that the mobile device will be downloading the commercials for later playout, perhaps offline. The ad server will be aware that the mobile device will be downloading the ads, from information sent by the device to the ad server in the request (e.g., information indicating that the request comes from a specific user-agent such as a "download-player"). The ad server may alter its selection accordingly. For instance, the ad server may not select interactive commercials, since most interactive elements work best with a live network connection.
 The process of selecting and downloading commercials and metadata to the mobile device is depicted in FIG. 16. As shown in FIG. 16, the app initiates the download of the video item and then contacts the ad server. The ad server selects appropriate commercials and delivers them with metadata to the device. The commercials and the metadata are saved on the device for later use.
Managing the Cache of Commercials
 In some circumstances, an insufficient number of downloaded commercials, with respect to the number of downloaded videos, the total duration of downloaded videos, the total number of insertion points for all the downloaded videos, or some combination of any two or more of these and other factors, may cause the app to prevent playout of some of the downloaded videos. For instance, a downloaded video may have three commercial insertion points. If the device currently holds only two downloaded commercials, the app may indicate that the video cannot playout offline until additional commercials are available.
 Downloading can occur in bursts in which two or more or a large set of commercials is downloaded at one time, or can be distributed so that individual commercials are downloaded from time to time, or any combination of those. The app may download a large number of commercials in low quality video formats, to quickly populate the offline cache, and subsequently download higher-quality versions of these (or other) commercials. For example, the app may download twenty commercials, each 15 s in duration and encoded at 0.3 Mb/s, for a total size of 11.2 MB. Subsequently, the app may download a new batch of 20 commercials, each 15 s in duration and encoded at 0.9 Mb/s, for a total size of 33.6 MB. The replacement of lower-quality versions by higher-quality versions need not be done in batches but can be done individually, for example. The logic for deciding how many commercials to download and how frequently to replace the commercials may reside on the app (at the mobile device), or may reside at some other system component.
 The app receives and stores 218 these downloaded commercials on the mobile device, e.g., in the offline cache 202 on the mobile device's non-volatile storage 222.
 The app may be configured to have a quota, a maximum amount of non-volatile storage to use in storing downloaded commercials. For example, a 200 MB quota is enough space for 100 video commercials each of size 2 MB. The app may set the quota as a fixed number, or as a fraction of the overall non-volatile storage capacity of the device, or in any of a variety of other ways. The quota can change from time to time depending on various factors.
 The app may adhere to a set of rules 301 (FIG. 4) governing when commercials may be delivered from the server to the device's offline cache, e.g., only when the device is above 50% charged, only when the network connection is WiFi; only when the device has at least a certain amount of available storage space, or a combination of any two or more of those and other factors. The app may adhere to a set of rules governing when it can download commercials over a cellular data network, e.g., only between midnight and 5 AM, when the cellular network is not in heavy use. The app may regulate the amount of data it consumes over a given time period (e.g. daily, weekly, monthly) over a cellular network, to avoid "overage charges" that are imposed on cellular subscribers who consume excessive amounts of cellular data.
 The app may moderate the pace at which it downloads commercials based on the number of commercials stored in the offline cache. For instance, the app may download commercials with all available bandwidth until the app reaches a minimal threshold of (e.g., 20) commercials in the offline cache, and then only download at most 10 new commercials per week.
 The app may download commercials before, during, or after the download of user-selected videos or in any combination of two or more of those times. It may do so without the user being aware that the downloading is occurring. It may do so in the background, without the app or any of its features being shown on the device's screen. It may do so automatically, on a preset interval (e.g., every day or every week).
 The app may interleave the download of commercials with the download of videos. For example, the app may have a queue of five user-requested videos (totaling 400 MB) and fifteen commercials (totaling 30 MB) for a total download queue of 430 MB. The app may alternate (one by one or in groups) the download of queued videos with queued commercials in any sequence over time. The app may or may not indicate to the user that it is downloading commercials. The app may separate a queued video into several parts, and insert a commercial (or part of a commercial) between downloading each part. As shown in FIG. 8, for example, on the left 302, the queue includes simply three user-selected videos to be downloaded in order. In the middle 304, the queue has been altered so that seven commercials have been interleaved in the download queue. To the right 306, the user-selected videos have been broken up and commercials have been interleaved not only between complete videos but also between smaller parts of full videos.
 In some implementations, commercials may "belong" to a specific show and can only be played in conjunction with that show. In the terminology we introduced above, the metadata for the commercials would specify a particular show in the `use-against` field. For example, an advertiser (Walmart, say) may purchase a set of impressions against the show "Survivor" or against a specific episode of "Survivor." In this scenario, when downloading commercials, the app will download a set of appropriate commercials for each downloaded video item. Since a 45-minute TV show typically contains 15 minutes of commercials, the app will download 15 minutes of commercials for a 45-minute downloaded video item. One might think of the cache of commercials on the device as segregated into groups, one group belonging to each downloaded video item.
 The app may download a set of "backup commercials" which are available for insertion when no other commercial is available. Typically, a backup commercial will have minimal constraints on when it can be played--at any time, inside any video item, and no expiry, among other examples. A backup commercial might be, for example, a general promotion or a public service announcement that has no inherent expiry. The app may select one of the saved backup commercials in case another commercial that has an association with a video program is not available for playout (e.g., they have all expired.)
 The app will not typically present a list of downloaded commercials for the user to view and interact with; rather, the app will silently store and manage these commercials, without explicitly informing the user. The app may present a minimal view to the user showing only that commercials are downloading.
 Some mobile devices support the notion of multiple users, each with their own login to the device. For example, starting with version 4.2, Android devices support multiple users on a single device, each with their own login. In some instances, the app can provide a separate local ad cache 380 for each user 382, and draw from that user's cache when that user is logged in (see FIG. 15). One advantage of doing so is that the advertisers can target individual users, not just devices. A husband and wife sharing a single tablet may then see different commercials inside the same downloaded TV show or other video.
Refreshing the Cache of Commercials
 From time to time, the app may refresh its set of cached commercials.
 The refresh may be initiated from the app itself. The refresh may be initiated from a server that sends a signal (e.g., and Android Push Notice or Apple Push Notification) to the app on the device to perform the refresh. Triggering events for a refresh may include (among other) any one or a combination of any two or more of: (a) when a certain amount of time (say 3 days) has elapsed since the app last performed a refresh of its cached commercials, (b) when a certain number or fraction of cached commercials have expired, and (c) when the location of the mobile device has changed significantly (e.g. more than 50 miles) and a sufficient number of cached commercials are now marked as "OutOfGeo."
 Based on one of these triggering events, the app may initiate a refresh of its cache of commercials. That is, the app will contact the ad server to request a new inventory of commercials.
 The app may mark as expired any commercial that has been played the number of times specified in its associated metadata (defined above as "max impressions"), denoted by Q. The app may mark as expired a commercial which has been played at least Q-k times, where k is a fixed parameter in the app, for example 3. The app may mark as expired a commercial that is past its "use-by" metadata. The app may mark as expired a commercial that that has resided on the device for a duration of time T, where T is a fixed parameter in the app, for example one week. Various combinations of any two or more of these and other conditions may also be applied to control the expiry of commercials.
 The app may mark as "OutOfGeo" any commercial for which the "use-nearby" metadata indicates a different location from where the device is now.
 FIG. 17 depicts an example of the process by which the app evaluates a single cached commercial. The app inspects the commercial. If it is been viewed more than 10 times, it is marked as expired. If it has not been viewed more than 10 times, and the current time is past the "use-by" window, the app also marks the ad as expired. If the ad has not been viewed more than 10 times and is not passed the "use-by" window, the app checks whether the location of the mobile device is outside of the "use-nearby" window. If so, the ad is marked as "OutOfGeo". Otherwise, the ad is marked as "InGeo".
 When the refresh occurs, the app contacts the ad server to request a new commercial to use in place of some or all of the cached commercials. At the very least, the app will request a replacement commercial for any expired commercial. The app may also request a replacement for any commercial marked as "OutOfGeo." The app queues the new commercials for download.
 As an example of the "location change" criteria, imagine that the app detects (using standard location-based APIs available on mobile platforms such as iOS and Android) that the device has moved from New York City to Cleveland, Ohio. Transparently and without the user needing to be aware of it, the app will then mark all appropriate commercials as "InGeo" or "OutOfGeo." When a subsequent refresh occurs, the OutOfGeo commercials may be replaced or retained in case the user moves back into the relevant geographical area.
Providing Access to Commercials
 In some implementations, the downloaded commercials are used only for insertion into videos that are played by one app on the device. However, in some implementations, other apps and features of the mobile device can make use of the stored commercials and associated metadata for a wide variety of purposes.
 For example, a phone-dialing app 311 (FIG. 4) can play out a previously-downloaded video commercial while the user is waiting for the call to go through. An app can play out a previously-downloaded commercial every time the device is powered on. A game app 313 can require the user to view a previously-downloaded commercial before playing the game. Another video-playing app 310 can select from among the previously-downloaded commercials and play out one or more at pre-specified insertion points. The creators of an app may publish two versions of the app for download and installation: a free version that draws on one of the previously-downloaded commercials on every app launch before the user may use the app, and a paid-for version which is free of commercials.
 In some implementations, to make it easier for app developers to take advantage of the stored ads and metadata, the app (or even the operating system of the mobile device) can expose an API (application programming interface) 209 (FIG. 4) to other apps 213 installed on the device, to permit those other apps to request (and then playout) one or more commercials from the set of previously-downloaded commercials. We call the software component of the app that provides this functionality a "client ad engine." The API may provide a mechanism by which the other apps can request a commercial; the client ad engine will select from among the stored commercials to choose an appropriate commercial. The API may also permit other applications to add commercials into the set of stored commercials.
 Therefore, in some implementations, apps loaded on and running on the mobile device can invoke the client ad engine to use the stored commercials for a variety of purposes.
 The following is an example of a simple API.
TABLE-US-00001 String getStoredCommercial(String appID); // returns URL on disk of selected commercial bool saveStoredCommercial(String commercialURL); // register a new downloaded commercial bool recordPlayoutOfCommercial(String commercialURL); // record that a commercial was played
 Thus, multiple apps 213, 310, 311 and 313 can use one common client ad engine 203 on the device through the API.
Recording Views and Tracking and Measuring Usage of Ads
 Typically, streaming video systems include one or more mechanisms for recording when a mobile device has begun, is somewhere in the middle of playing, or has completed playout of a commercial. As previously discussed, tracking beacons are one common mechanism. Tracking beacons are typically a URL (i.e. the address of an remote Internet server) that the device connects to in order to register this event. Typically, an application or web browser will perform a network call (typically using HTTP) to the URL. The network call typically contains information including the "user-agent" (a description of the device performing the network call) and perhaps information stored from a previous transaction (e.g. one or more web cookies).
 The device must be online to execute the network call for the tracking beacon. When the device is playing a previously-downloaded commercial and the device is offline, the device cannot reach a remote server to perform the tracking beacon, or to in any other way report that a commercial has been played and cannot report any other metrics concerning the use of commercials on the device.
 Instead, in some implementations, the app records on the mobile device the URL of the tracking beacon, along with a timestamp recording exactly when the device would have performed the network call to the URL if the device were online. More generally, the app records the identity of each commercial that is played, along with a timestamp recording exactly when each commercial was played. The app may also record other information related to the playout of the commercial, including, for example, the location of the device during playout of the commercial, the identity of the video that the commercial was inserted into, and the duration of the commercial that the user played. Other kinds of information and combinations of information can be recorded. We call this information for a commercial, collectively, an "impression event." The impression event is stored on the device's non-volatile memory in a cache 325. The cache may contain multiple impression events recorded over a period of time.
 When the cache is non-empty, the app checks for network connectivity at regular intervals, and uploads this set of recorded impression events from the cache to a remote server (i.e. an analytics server) that accumulates this information (the server is labeled analytics 326 in FIG. 4) when it can. It may be several hours or even days before an impression event is transmitted from the mobile device to the analytics server 326. In some implementations, the app may automatically perform the network call (to the URL of the tracking beacon) to a remote server once the device regains network connectivity, whether or not the app is active or running at the time the device regains network connectivity. In some implementations, the app may upload a file containing the stored tracking beacons to another server (a proxy), which itself performs the network calls on behalf of the app.
 In the download scenario, the app will be playing a previously-downloaded commercial. If the device is online when the commercial is played, then the app may perform the network call to execute a tracking beacon. If the device is offline when the commercial is played, the app may store the beacon 330 along with a timestamp 332 of when the beacon was encountered. At the next or subsequent opportunity when the device has network connectivity, the app may call the beacon URL along with the timestamp.
 One of the benefits of online video ads, as opposed to a TV broadcast commercial, is interactivity. Online ads may encourage the user of the device to perform an action (e.g., tap on the screen, press a key, nod their head, or some other behavior), which triggers the app to offer more information about the advertiser. For example, FIG. 9 illustrates how a user may be encouraged to indicate their interest, and FIG. 10 shows the result--a web page for the advertiser which subsequently loads inside the device web browser. Typically the app suspends playout of the commercial while this action is performed, and playout resumes when the action is complete.
 Interactive commercials 340 often contain metadata 342 that specifies the interactive element 344 (for example, using a <VideoClicks> tag in the VAST specification).
 In order to perform the associated action, e.g. launch a web site or fetch data on a remote server, the app often needs network connectivity. In this case, the action will fail when the user has previously downloaded the commercial and is viewing it offline.
 Here we introduce an implementation that supports interactive commercials during offline playout in a number of ways including one or more of the following and combinations of any two or more of them:
 When downloading the commercial, the app also downloads all interactive instructions (in the case of a VAST-compliant system, this means downloading XML data nested within the <VideoClicks> element). If the user attempts to interact with the commercial while the device is offline, but the interactive element requires a network connection, the app records the user intent 346, and informs the user that the action will be performed when network connectivity is restored (See FIG. 13). If the user attempts again (a second or subsequent time) to trigger the interactive element while the device is offline, the app may ignore the request, or it may again inform the user that the action will be performed when network connectivity is restored.
 Having recorded the user intent to access the interactive content, the app may then begin monitoring for network connectivity. Alternatively, this check for connectivity may be performed by a separate application or process. The app may alert 348 the user (e.g., using a pop-up message on the home screen of the device) when network connectivity is restored, to inform the user that they can now perform the interactive action (e.g., launch the associated web page) corresponding to the commercial they saw previously (FIG. 14). In some cases, the app may perform this check at every app launch. In some cases, the app may perform this check at a fixed time interval. In some instances, the app may transmit to a server element the user intent, and the server can subsequently send an email to the user which includes the interactive element; the advantage of the latter approach is that the user can retain the email message and decide for themselves when to access the interactive content.
 To support deferred interactivity, the app monitors and persistently records the user interactions with ads while offline.
Videos from Digital Video Recorders (DVRs)
 In some embodiments, the mobile device downloads from a digital video recorder (DVR) one or more video items that have been previously recorded using the DVR. At least some of the downloaded video items can be integrated continuous videos that have ads embedded in them, such as television shows.
 We use the term DVR broadly to include, for example, any electronic device that records video to a persistent storage, such as a disk drive, either locally or in the "cloud" or a combination of the two. A DVR typically offers at least the following functionality:
 recording of a single TV show (or other video item) for later viewing (e.g., a specific football game)
 continual monitoring of a list of upcoming shows or other video items and recording of items, for example, those items that match a user-specified criteria (e.g. "All new episodes of Seinfeld" or "the last 3 episodes of Mad Men.")
 replaying of previously-saved TV shows or other video items
 deletion of previously-recorded TV shows or other video items, for example, in accordance with deletion rules or criteria
 Certain DVRs may offer additional functionality such as
 recording of more than one TV show or other video items simultaneously
 copying or transferring of previously recorded shows or other videos to an external device, such as a smartphone or tablet
 Typically, a DVR receives input from a network provider (e.g., cable or satellite TV operator) and transmits output to a television for viewing. A conventional DVR stores the recorded video items in a magnetic disk drive or solid-state memory that is contained within the DVR. A "Cloud DVR" stores the recorded video items on a remote server, connected to the DVR through a two-way network connection. Some DVR's can both store locally and store in the "cloud". A DVR is sometimes also referred to as a PVR, or "personal video recorder."
 Video items can be downloaded from a conventional DVR to a mobile device for later viewing using, for instance, the Slingbox and TiVo Stream products that both offer "sync and go" functionality to copy video items from a DVR to a mobile device. FIG. 24 depicts a screen shot of a user interface on a computer of one such product during the process of downloading a recorded TV show to a mobile device.
 In some cases, a product of this kind may work as follows:
 1. On a mobile device, the user launches an application (the application and some of its key functional components are depicted schematically in FIG. 19). The functional components include a media player, a download manager, and persistent memory. The download manager can include a policy manager, a cache manager, a player proxy, and HLS stack, analytics, and configuration facilities. The persistent memory can store metadata, a media cache, and a cache of stored video items.
 2. The application establishes a connection with the DVR. The connection may be through a cable that connects the device to the DVR. Alternatively, the connection may be via a wireless protocol such as WiFi or Bluetooth. The communication between the application and the DVR may rely on common communication protocols such as TCP/IP and HTTP, or a proprietary protocol.
 3. The application transmits to the DVR a request for a list of video items saved on the DVR. The DVR transmits this list, and the application displays the list on the screen. The user selects one video item from the list, for downloading to the mobile device. In some cases, the application may show only a partial list of video items on the DVR, if (for instance) certain saved shows on the DVR are not allowed to be copied.
 4. The application transmits a request for the selected item to the DVR.
 5. The DVR converts ("transcodes") the requested item to a file format that is compatible with and usable by the target mobile device. For example, the DVR may store the video item in MPEG-2 format, and in this step creates a copy of the video item in h.264 format. During this step, the DVR may also encrypt the video item. The DVR may perform this conversion step when a mobile device requests the item. In some implementations, the DVR may perform the conversion step during or immediately after the video item is initially recorded. In some cases, a separate device (e.g. a TiVo Stream) performs this conversion.
 6. The DVR delivers the transcoded item to the mobile device. The item may be delivered in different formats, e.g., as a flat file (e.g. .mp4), a streaming format such as Smooth or HLS, or as a progressive download.
 7. In some cases, the DVR may delete the original recording before, during, or after the video is downloaded to the mobile device.
 A DVR typically does not distinguish between a TV show and the commercials contained in that show. The DVR records video from a specific TV channel from a start time to an end time. The resulting recording on the DVR is typically a single, monolithic, continuous, integrated video item consisting of the TV show and whatever commercials and other video elements were embedded in the recorded show as originally received at the DVR. In some cases, the video item that is recorded may not be a single show, but instead contain parts of one or multiple shows.
 Today, those DVRs that support copying or transferring of recorded video to a mobile device typically copy the entire video item or stream, including whatever embedded commercials may exist--wholesale (as an entire single monolithic integrated video item) to the target mobile device.
 In some cases it would be desirable if the commercials embedded in the video item were to be replaced by other commercials. Advantages of this approach, which we describe below, include:
 The commercials embedded in the original video item may expire. For instance, a user may record an episode of a TV show the day before Thanksgiving that contains a commercial for a one-day-only "Black Friday" sale the day after Thanksgiving. If the user copies the video item from her DVR to her mobile device and watches the video item a week later, that "Black Friday" commercial has little or no value to the advertiser.
 There may be higher-value commercials available to show, for example, when the user is playing the video item on a mobile device, or in a particular location. For instance, an advertiser may offer a relatively higher rate (typically measured in "CPM" or "cost per thousand impressions") for a guarantee that all their commercials are viewed on an iPhone within the greater New York City area.
 We now describe a method for replacing one or more of the "baked-in" (embedded) commercials in the downloaded video item with one or more higher-value or different commercials.
 The overall workflow is depicted in FIGS. 20, 21, and 22. All three figures depict similar basic steps.
 1. The user requests a video to be downloaded from the DVR to the mobile device.
 2. The application on the mobile device contacts the DVR and executes the download.
 3. The application contacts the ad server and supplies information to the ad server that allows the ad server to generate a list of commercials for the video item. The information may include the name of the recorded video, the channel of the recorded video, when the show was recorded, when the show was downloaded to the mobile device, the make or model of the mobile device, the location of the mobile device, personally-identifying information about the user of the mobile device, or combinations of any two of more of them and other information.
 4. Using the information supplied by the application, the ad server selects a group of commercials and delivers the commercials, or information such as a URL which identifies the location of each commercial.
 The variants among FIGS. 20, 21, and 22 revolve around whether the DVR is a conventional DVR (FIG. 20) or Cloud DVR (FIG. 21, 22) and whether the user indicates her download request using the application on the mobile device (FIGS. 20, 21) or on the DVR itself (FIG. 22).
 As shown in the process of FIG. 20, the user can request a TV show download to the mobile device through the app running on the mobile device. The request is transmitted through, for example, a Wi-Fi router, to a conventional DVR that stores the videos on disk and has transcoding facilities as described earlier. The app on the mobile device also requests commercials for the show. This can be done either in parallel with the request for the downloading of the video, or before, or after the video has been downloaded to the mobile device. Once the ad server has selected commercials for the video, it delivers them through the Internet, a broadband router, and a Wi-Fi router, in this instance, to the mobile device.
 The process shown in FIG. 21 is similar except that the video item is delivered from the cloud DVR rather than from the conventional DVR. The process shown in FIG. 22 is similar to the one in FIG. 21 except that the request of the user is made from a consumer device that can communicate with the cloud DVR.
 As shown in FIG. 23, the source video stream (or video item) as recorded by the DVR includes commercials and possibly other items inserted in the original program, both illustrated by vertical gray stripes. The copy of the video item as downloaded from the DVR to the mobile device contains all of the commercials and other items in the integrated whole video item, as mentioned earlier. After downloading the video item from the DVR, the mobile device applies an algorithm to detect the times of the start and end of each commercial in the downloaded video. Such algorithms are widely published, for instance http://www.mythtv.org/wiki/Commercial_detection. The resulting lookup table is stored in the mobile device's persistent storage and contains a list of entries. Each entry identifies one of the commercials (for example, C1) and identifies the beginning time or the ending time of that commercial within the video item. The cache of commercials stored on the mobile device is also shown on FIG. 23.
 At some later time, the user may launch the application on the mobile device and will see a menu of available videos, including the video(s) downloaded from the DVR. The user can then indicate her selection of a downloaded video to be played back.
 During playout of the downloaded video, the application monitors the amount of time elapsed since the beginning of the video item, and compares the time against the entries in the lookup table. When the application reaches the first commercial break in the video, as indicated by a beginning-time entry in the lookup table, the application selects a commercial from the list of previously-downloaded commercials corresponding to this video. The application pauses the video at the identified time and plays back the selected commercial. The application monitors the playback of the commercial. When the end of the commercial is reached, the application resumes playout of the main content of the video item beginning at the time identified in the lookup table as the ending time of that commercial segment.
 The previously-described logic related to each of the tracking beacons, expiring and refreshing commercials, and using backup commercials, and combinations of any two or more of them, also may be applied in the context of FIGS. 20 through 23.
 A wide variety of other variants of the processes described above may also be used. For example, the commercial-detection may be performed on the DVR itself, rather than the mobile device; i.e., the DVR itself can perform a commercial-detection algorithm to determine the location of the ads in the recorded video. The DVR can then download the entire video (with commercials) to the mobile device, or the DVR can remove the original commercials from the video before downloading it to the mobile device. In either case, the DVR delivers to the mobile device (along with the downloaded video) a lookup table containing the time-offset of the commercials in the recorded video.
 If the device is online during video playout, the application can directly query the ad server for "fresh" commercials, rather than using the cached commercials. The application can download and play or simply play (using progressive download or another protocol) these fresh ads. When the ad server responds with a set of URLs for the fresh commercials, the application may compare these URLs against the already-downloaded commercials, in case the application can simply use one of the cached commercials, to save on the bandwidth of accessing the same commercial again from the network. Instead of replacing the original commercials immediately, the mobile device may retain the original commercials for some number of days, for example, after the show was originally broadcast. Nielsen-style ratings accord credit to a TV network for airing a commercial up to 3 or sometimes 7 days after the show's initial broadcast, to capture much of the subsequent playout that occurs using DVRs. In case the original commercials are of high value, the mobile device may sometimes wait until between 4 and 8 days after the DVR originally recorded the video before replacing the original ads.
 The techniques described here can be implemented in digital electronic circuitry, or in hardware, firmware, software, or in combinations of them. The techniques can be implemented as a program product, i.e., a computer program tangibly embodied in an information carrier, e.g., in a machine-readable storage device or in a propagated signal, for execution by, or to control the operation of a processor, a computer, or multiple computers. A program can be written in any form of programming language, including compiled or interpreted languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing or mobile environment. A program can be deployed to be executed on one computer or mobile device or on multiple computers or mobile devices at one site or distributed across multiple sites and interconnected by a communication network.
 Activities that we describe can be performed by one or more programmable processors executing a program to perform functions by operating on input data and generating output. Method steps can also be performed by, and apparatus of the invention can be implemented as, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit). Modules can refer to portions of the program and/or the processor/special circuitry that implements that functionality.
 Processors suitable for the execution of a program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer or mobile device. Generally, a processor will receive instructions and data from a read-only memory or a random access memory or both. Generally, a computer or mobile device will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks. Information carriers suitable for embodying program instructions and data include all forms of non-volatile memory, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The processor and the memory can be supplemented by, or incorporated in special purpose logic circuitry.
 To provide for interaction with a user, the techniques that we describe can be implemented on a computer or mobile device having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, or a touch surface, by which the user can provide input to the computer or mobile device (e.g., interact with a user interface element, for example, by clicking a button on such a pointing device or touching the touch surface). Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input.
 The techniques that we describe can be implemented in a distributed system that includes a back-end component, e.g., as a data server, and/or a middleware component, e.g., an application server, and/or a front-end component, e.g., a client computer or mobile device having a graphical user interface and/or a Web browser through which a user can interact with an implementation of the invention, or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network ("LAN") and a wide area network ("WAN"), e.g., the Internet, cellular telephone networks, and Wi-Fi, and include both wired and wireless networks.
 The computing system can include clients and servers. A client and server are generally remote from each other and typically interact over a communication network. The relationship of client and server arises by virtue of programs running on the respective computers or mobile devices and having a client-server relationship to each other.
 Other implementations are within the scope of the following claims.
Patent applications by Adam L. Berger, Pittsburgh, PA US
Patent applications by Joshua Pressnell, Dayton, OH US
Patent applications by Richard David Jackson, Curitiba BR
Patent applications by Penthera Partners, Inc.
Patent applications in class PROGRAM, MESSAGE, OR COMMERCIAL INSERTION OR SUBSTITUTION
Patent applications in all subclasses PROGRAM, MESSAGE, OR COMMERCIAL INSERTION OR SUBSTITUTION