Set video breaks

30/11/2019
The YouTube XML format is being replaced by DDEX (music only) and CSV templates (all industries). YouTube strongly discourages any new implementations of the YouTube XML format. This page should be used solely as reference material for existing implementations. Visit Using the YouTube DDEX feed for more information about the new format.
The features described in this article are available only to partners who use YouTube's Content Manager to manage their copyrighted content.

A <video_breaks> tag identifies the times when advertisements can occur during a video. You can specify the break times as the number of seconds after the start of the video or as the time in HH:MM:SS format when the break occurs. You also have the option to show in-stream ads at break times automatically determined by YouTube, using the <break> tag's auto_midrolls attribute instead of identifying specific times.

The auto_midrolls feature is currently in beta test and is not yet generally available.

To display pre-roll ads (before the video starts), specify a break at time 0; to display post-roll ads (at the end of the video), specify a break time -1.

 <video_breaks video="/external/video[@id='VIDEO_ID_1_']">
    <break time="0"/> 
    <break time="00:06:12"/>
    <break time="685"/> 
    <break time="00:20:37"/>
    <break time="-1"/> 
 

 

To clear the video breaks previously set for a video, define a relationship between the video and an empty <video_breaks> tag.

<video_breaks tag="VIDEO_1_"/>
 <relationship>
   <item path="/external/video[@id='YH_OOaMUNoA']"/>
   <related_item path="/feed/video_breaks[@tag='VIDEO_1_']"/>
 

 

Third-party ad serving

YouTube's partner ad serving feature enables you to use a third-party ad server to forecast, sell, traffic and report on in-video ads that YouTube shows on your videos. When you use a third-party ad server, the YouTube video player will send a request to the ad server when a user watches your video. The player will then handle the ad server's response, which will contain information about the ads to show for the video, and display the appropriate ads.

If your account is enabled for this feature, you use subtags of the <video_breaks> tag to identify the third-party platform and provide ad targeting information for each ad break.

  • The <third_party_ad_server> tag contains information that YouTube will need to request ads from a third-party ad server. This information includes the base URL for the third-party ad server as well as a value that uniquely identifies the video for which you are requesting ads.

  • The <advertising> tag, which appears inside the <break> tag, contains advertising information about the break, such as a list of ad slots that should run in the break. For each slot, you can specify an ID, which can be communicated to the ad server. You can also specify the type of each slot – e.g. commercial, sponsorship, brand, etc. The slot type could affect YouTube's fallback behavior if the third-party server does not return ads.

The XML snippet below shows a <video_breaks> tag that contains targeting information for a third-party ad server.


<video_breaks>
  <third_party_ad_server>
    <targeting_url>http://www.example.com/ad_server
    <ad_server_video_id>xyz1941
  

  
  
  <break time="0">
    <advertising>
      <ad_server>
        <slot id="x1"/>
        <slot id="x2"/>
        <slot id="x3">
          <type>Sponsorship
        
      
    
  

  
  <break time="00:10:25">
    <advertising>
      <ad_server>
        <slot id="x4"/>
        <slot id="x5">
          <type>Brand
        
      
    
  

  
  <break time="-1">
    <advertising>
      <ad_server>
        <slot id="x6">
          <type>Sponsorship
        
        <slot id="x7"/>
        <slot id="x8">
          <type>Brand
        
      
    
  


<relationship>
  <item path="/external/video[@id='1ldklaqikdq']"/>
  <related_item path="/feed/video_breaks[0]"/>

* Nguồn: Youtube