Twitch SDK (Internal)
adtypes.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2017 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
11 #include <map>
12 #include <stdint.h>
13 #include <string>
14 #include <vector>
15 
16 namespace ttv
17 {
18  namespace ads
19  {
20  enum class TrackingEventType
21  {
22  Unknown,
23 
25  Start,
27  Midpoint,
29  Complete,
30  Mute,
31  Unmute,
32  Pause,
33  Rewind,
34  Resume,
35  Fullscreen,
37  Expand,
38  Collapse,
40  Close,
41  Skip,
42  Progress
43  };
44 
45  struct MediaFile
46  {
48  : height(0)
49  , width(0)
50  , bitrate(0)
51  , maintainAspectRatio(false)
52  , scalable(false)
53  {
54  }
55 
56  std::string resourceUrl;
57  std::string type;
58  std::string delivery;
59  std::string identifier;
60  uint32_t height;
61  uint32_t width;
62  uint32_t bitrate;
64  bool scalable;
65  };
66 
68  {
70  : durationSeconds(0)
71  {
72  }
73 
74  std::string clickThroughUrl;
75  std::vector<std::string> clickTrackingUrls;
76  std::vector<MediaFile> mediaFiles;
77  std::map<TrackingEventType, std::vector<std::string>> trackingEventUrls;
78  std::string adParametersString;
79  uint32_t durationSeconds;
80  };
81 
83  {
85  : height(0)
86  , width(0)
87  {
88  }
89 
90  std::string identifier;
91  std::string creativeType;
92  std::string resourceUrl;
93  std::map<TrackingEventType, std::vector<std::string>> trackingEventUrls;
94  uint32_t height;
95  uint32_t width;
96  };
97 
98  struct Impression
99  {
100  std::string identifier;
101  std::string resourceUrl;
102  };
103 
104  enum class AdPosition
105  {
106  Undefined = 0,
107  Preroll = 1,
108  Midroll = 2,
109  Postroll = 3
110  };
111 
112  enum class ContentMode
113  {
114  Live,
115  Vod,
116  Playlist,
117  VodCast
118  };
119 
121  {
123  : contentMode(ContentMode::Live)
124  , channelId(0)
125  , lengthInSeconds(0)
126  , position(AdPosition::Preroll)
127  , mature(false)
128  , live(true)
129  {
130  }
131 
132  std::string source;
133  std::string channelName;
134  std::string game;
135  std::string vodType;
136  std::string vodName;
137  std::string vodID;
138  std::string ppid;
141  uint32_t lengthInSeconds;
143  bool mature;
144  bool live;
145  };
146 
147  struct Ad
148  {
149  Ad()
150  : sequenceNumber(0)
151  {
152  }
153 
154  std::string identifier;
155  std::string adSystem;
156  std::string adTitle;
157  std::string adDescription;
158  std::vector<Impression> impressions;
159  std::vector<LinearCreative> linearCreatives;
160  std::vector<CompanionCreative> companionCreatives;
161  std::vector<std::string> errorUrls;
162  uint32_t sequenceNumber;
163  };
164 
166  {
167  std::string languageCode;
168  std::string userAgentString;
169  std::string adUnit;
170  std::string adTrackingIdentifer;
171  std::string platform;
176  std::vector<std::string> mediaTypeFilters;
177  };
178  }
179 }
std::string channelName
Definition: adtypes.h:133
std::string identifier
Definition: adtypes.h:90
std::string userAgentString
Definition: adtypes.h:168
TrackingEventType
Definition: adtypes.h:20
std::string resourceUrl
Definition: adtypes.h:92
std::string adTitle
Definition: adtypes.h:156
std::vector< std::string > clickTrackingUrls
Definition: adtypes.h:75
Definition: adtypes.h:45
Definition: adtypes.h:165
bool maintainAspectRatio
Definition: adtypes.h:63
Definition: adtypes.h:120
std::string adDescription
Definition: adtypes.h:157
AdPosition position
Definition: adtypes.h:142
std::string identifier
Definition: adtypes.h:100
AdFetchRequestInfo()
Definition: adtypes.h:122
CompanionCreative()
Definition: adtypes.h:84
std::map< TrackingEventType, std::vector< std::string > > trackingEventUrls
Definition: adtypes.h:77
uint32_t bitrate
Definition: adtypes.h:62
std::string ppid
Definition: adtypes.h:138
std::string game
Definition: adtypes.h:134
Ad()
Definition: adtypes.h:149
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
ContentMode
Definition: adtypes.h:112
bool mature
Definition: adtypes.h:143
std::vector< std::string > mediaTypeFilters
Definition: adtypes.h:176
uint32_t lengthInSeconds
Definition: adtypes.h:141
std::map< TrackingEventType, std::vector< std::string > > trackingEventUrls
Definition: adtypes.h:93
Definition: adtypes.h:98
MediaFile()
Definition: adtypes.h:47
LinearCreative()
Definition: adtypes.h:69
std::string creativeType
Definition: adtypes.h:91
std::string resourceUrl
Definition: adtypes.h:101
std::string platform
Definition: adtypes.h:171
std::vector< std::string > errorUrls
Definition: adtypes.h:161
std::string adSystem
Definition: adtypes.h:155
std::string identifier
Definition: adtypes.h:154
AdPosition
Definition: adtypes.h:104
std::string source
Definition: adtypes.h:132
uint32_t durationSeconds
Definition: adtypes.h:79
std::string adTrackingIdentifer
Definition: adtypes.h:170
std::string languageCode
Definition: adtypes.h:167
std::string delivery
Definition: adtypes.h:58
bool scalable
Definition: adtypes.h:64
ContentMode contentMode
Definition: adtypes.h:139
std::string resourceUrl
Definition: adtypes.h:56
uint32_t sequenceNumber
Definition: adtypes.h:162
std::vector< LinearCreative > linearCreatives
Definition: adtypes.h:159
std::string type
Definition: adtypes.h:57
uint32_t height
Definition: adtypes.h:94
std::string identifier
Definition: adtypes.h:59
std::string adParametersString
Definition: adtypes.h:78
std::string vodName
Definition: adtypes.h:136
bool live
Definition: adtypes.h:144
std::vector< CompanionCreative > companionCreatives
Definition: adtypes.h:160
std::string clickThroughUrl
Definition: adtypes.h:74
uint32_t ChannelId
Definition: coretypes.h:23
uint32_t height
Definition: adtypes.h:60
std::vector< MediaFile > mediaFiles
Definition: adtypes.h:76
std::string vodType
Definition: adtypes.h:135
uint32_t width
Definition: adtypes.h:95
Definition: adtypes.h:82
Definition: adtypes.h:67
Definition: adtypes.h:147
uint32_t width
Definition: adtypes.h:61
std::vector< Impression > impressions
Definition: adtypes.h:158
std::string vodID
Definition: adtypes.h:137
std::string adUnit
Definition: adtypes.h:169
ChannelId channelId
Definition: adtypes.h:140