You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Code/Conviva/Source/Base/Events/ConvivaHandlers/PlayerHandler.swift
+24-14Lines changed: 24 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -195,25 +195,32 @@ class PlayerHandler {
195
195
log("not processing currentSourceChange")
196
196
return
197
197
}
198
-
self.unreportedEncodingType =nil
198
+
199
+
/* EncodingType reporting: The currentSourceChange event is used to extract the encoding type of the internally selected source. For HLS, this event is dispatched right before the sourceChange event. For HESP sources, it is dispatched after the play event, when a valid endpoint has been selected.*/
200
+
201
+
varcalculatedEncodingType:String?=nil
199
202
switch sourceType.lowercased(){
200
203
case"application/vnd.theo.hesp+json":
201
-
self.unreportedEncodingType="HESP"
204
+
calculatedEncodingType="HESP"
202
205
case"application/x-mpegurl",
203
206
"application/vnd.apple.mpegurl",
204
207
"video/mp2t":
205
-
self.unreportedEncodingType="HLS"
208
+
calculatedEncodingType="HLS"
206
209
default:
207
-
self.unreportedEncodingType=nil
210
+
calculatedEncodingType=nil
208
211
}
209
212
210
-
ifself.encodingTypeIsPending,
211
-
let encodingType =self.storage?.metadataEntryForKey(ENCODING_TYPE)as?String??self.unreportedEncodingType {
212
-
// report the pending encodingType and reset the pending state
213
-
self.setContentInfo([ENCODING_TYPE:encodingType])
214
-
self.unreportedEncodingType =nil
215
-
self.encodingTypeIsPending =false
216
-
log("unreportedEncodingType reset after processing pending encodingtype")
/* For HESP sources the encodingType is not available at session startup (play event) and encodingType will have been marked as pending. Once the currentSourceChange event is dispatched, this mark indicates the calculated encodingType can be pushed immediately to conviva and the mark can be reset. */
215
+
ifself.encodingTypeIsPending {
216
+
self.setContentInfo([ENCODING_TYPE:encodingType])
217
+
self.unreportedEncodingType =nil
218
+
self.encodingTypeIsPending =false
219
+
}
220
+
/* For HLS sources we cache the encoding type till the play event (Conviva session creation), at which the cached value will be pushed to conviva and the caching is reset to prevent further reporting. */
metadata.merge(adDescriptionMetadata){(_, new)in new }
262
269
263
-
// Do not override `encoding_type` value if already set by the customer.
270
+
/* EncodingType reporting:
271
+
1. A customer set encodingType always has precedence over the calculated encodingtype
272
+
2. For HLS sources (unreportedEncodingType is set on earlier currentSourceChange event) we can now report the encodingType.
273
+
3. For HESP sources (unreportedEncodingType is still nil) we mark the encodingType as pending, because the currentSourceChange event will be dispatched after the play event).
0 commit comments