Skip to content

Commit

Permalink
Merge pull request #165 from guardian/ravi/add-video-event
Browse files Browse the repository at this point in the history
Add `sendVideoEvent` and `fullscreen` methods to `Videos` service
  • Loading branch information
arelra authored Aug 20, 2024
2 parents 382dc4b + c946c82 commit c6d7352
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .changeset/silver-lemons-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"bridget": major
---

Add sendVideoEvent and fullscreen methods to Videos service

The sendVideoEvent method is required to send video events from webviews to the native layer so that they can be forwarded to Ophan. Webviews do not have access to the Ophan page view id and the native layer will also handle offline mode and batching of requests.

The fullscreen method is required for Android as the web YouTube player performs a no-op for fullscreen on Android. We therefore need to instruct the native layer to resize the player into a fullscreen view.
21 changes: 20 additions & 1 deletion thrift/native.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ union Metric {
3: MetricFont font;
}

enum MediaEvent {
request = 0,
ready = 1,
play = 2,
percent25 = 3,
percent50 = 4,
percent75 = 5,
end = 6
}

struct VideoEvent {
/** for YouTube Atoms videoId should the atom id */
1: required string videoId;
2: required MediaEvent event;
}

enum PurchaseScreenReason {
hideAds = 0,
epic = 1
Expand Down Expand Up @@ -123,7 +139,10 @@ service Gallery {

service Videos {
void insertVideos(1:list<VideoSlot> videoSlots),
void updateVideos(1:list<VideoSlot> videoSlots)
void updateVideos(1:list<VideoSlot> videoSlots),
void sendVideoEvent(1:VideoEvent videoEvent),
/** Android only */
void fullscreen(),
}

service Metrics {
Expand Down

0 comments on commit c6d7352

Please sign in to comment.