Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/csai #18

Merged
merged 38 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
36802ce
Detect react version for eslint
Jeroen-Veltmans Feb 1, 2024
da0448c
Improve SeekBar during ads
Jeroen-Veltmans Feb 1, 2024
e0d7c32
Simplify
Jeroen-Veltmans Feb 1, 2024
32ec60c
Add AdDisplay component
Jeroen-Veltmans Feb 1, 2024
e1cb7e5
Add AdCountdown component
Jeroen-Veltmans Feb 2, 2024
5703593
Add AdSkipButton
Jeroen-Veltmans Feb 5, 2024
b331d5f
Keep track if ad is in progress
Jeroen-Veltmans Feb 8, 2024
bd6e7ff
Use context.adInProgress instead
Jeroen-Veltmans Feb 8, 2024
856f4c8
Add AdClickThroughButton
Jeroen-Veltmans Feb 11, 2024
25ba305
Properly handle ad components after opening a menu
Jeroen-Veltmans Feb 11, 2024
5df1955
Optimize import
Jeroen-Veltmans Feb 12, 2024
a210715
Update theoplayer version to 6.9
Jeroen-Veltmans Feb 12, 2024
f9bf895
Hide theoplayer ad UI on web example page
Jeroen-Veltmans Feb 12, 2024
4495ea7
Temporary hack to fix screen shake with google ima
Jeroen-Veltmans Feb 14, 2024
1c8a651
Improve AdDisplay
Jeroen-Veltmans Feb 12, 2024
461b5bb
Fix typos
Jeroen-Veltmans Feb 13, 2024
ef74a8d
Add ad slot to UIContainer
Jeroen-Veltmans Feb 13, 2024
c18931d
Update Seekbar styling
Jeroen-Veltmans Feb 13, 2024
f1211b3
Update THEOplayerDefaultUi with ad slot
Jeroen-Veltmans Feb 13, 2024
5a9ab1f
Update example react-native-theoplayer
Jeroen-Veltmans Feb 16, 2024
a473494
Add initial mobile ad specific layout
Jeroen-Veltmans Feb 14, 2024
59814c0
Fix seekbar with DAI
Jeroen-Veltmans Feb 19, 2024
0bd9d1a
Enable google DAI for example
Jeroen-Veltmans Feb 20, 2024
4065727
Update example App
Jeroen-Veltmans Feb 14, 2024
a26047e
Update THEOplayer Default ad UI
Jeroen-Veltmans Feb 20, 2024
8fac848
Simplify
Jeroen-Veltmans Feb 20, 2024
de524c2
Simplify
Jeroen-Veltmans Feb 20, 2024
1c32233
Simplify
Jeroen-Veltmans Feb 22, 2024
fc6da42
Update ad skip button title
Jeroen-Veltmans Feb 23, 2024
6d0a63c
Update ad display styling
Jeroen-Veltmans Feb 23, 2024
f459916
Update theoplayer version
Jeroen-Veltmans Feb 23, 2024
edfa824
Update AdCountDown styling
Jeroen-Veltmans Feb 26, 2024
33dda24
Remove custom app styling
Jeroen-Veltmans Feb 23, 2024
4d13824
Add skip next svg
Jeroen-Veltmans Feb 25, 2024
4bf745b
Update ad click through styling
Jeroen-Veltmans Feb 25, 2024
6e49f1d
Update AdSkipButton
Jeroen-Veltmans Feb 25, 2024
2e7f0f5
Expand ad container
Jeroen-Veltmans Feb 26, 2024
76af8d0
Separate ad slots into own prop
Jeroen-Veltmans Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }]
},
"settings": {
"react": {
"version": "detect"
}
}
}
36 changes: 34 additions & 2 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import {useState} from 'react';
import {
AdClickThroughButton,
CenteredControlBar,
CenteredDelayedActivityIndicator,
ControlBar,
Expand All @@ -12,6 +13,7 @@ import {
PlaybackRateSubMenu,
PlayButton,
QualitySubMenu,
SeekBar,
SettingsMenuButton,
SkipButton,
Spacer,
Expand All @@ -26,6 +28,9 @@ import {
} from 'react-native-theoplayer';

import {Platform, StyleSheet, View, ViewStyle} from 'react-native';
import {AdDisplay} from '../src/ui/components/ads/AdDisplay';
import {AdCountdown} from '../src/ui/components/ads/AdCountdown';
import {AdSkipButton} from '../src/ui/components/ads/AdSkipButton';

const playerConfig: PlayerConfiguration = {
// Get your THEOplayer license from https://portal.theoplayer.com/
Expand Down Expand Up @@ -114,8 +119,9 @@ export default function App() {
}
bottom={
<>
<ControlBar style={{justifyContent: 'flex-start'}} />
<ControlBar />
<ControlBar>
<SeekBar />
</ControlBar>
<ControlBar>
<MuteButton />
<TimeLabel showDuration={true} />
Expand All @@ -125,6 +131,32 @@ export default function App() {
</ControlBar>
</>
}
adTop={
<>
<ControlBar>
<AdClickThroughButton />
</ControlBar>
</>
}
adCenter={
<>
<CenteredControlBar middle={<PlayButton />} />
</>
}
adBottom={
<>
<ControlBar style={{justifyContent: 'flex-start'}}>
<AdDisplay />
<AdCountdown />
<Spacer />
<AdSkipButton />
</ControlBar>
<ControlBar>
<MuteButton />
<SeekBar />
</ControlBar>
</>
}
/>
)}
</THEOplayerView>
Expand Down
1 change: 1 addition & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ hermesEnabled=true

# Enable THEOplayer Extensions (default: disabled)
THEOplayer_extensionGoogleIMA = true
THEOplayer_extensionGoogleDAI = true
18 changes: 9 additions & 9 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"react-native": "0.72.7",
"react-native-google-cast": "^4.6.2",
"react-native-svg": "^14.0.0",
"react-native-theoplayer": "^3.1.0",
"react-native-theoplayer": "^3.8.0",
"react-native-web": "^0.19.9",
"react-native-web-image-loader": "^0.1.1"
},
Expand All @@ -43,6 +43,7 @@
"node-polyfill-webpack-plugin": "^2.0.1",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"theoplayer": "^6.9.0",
"typescript": "4.8.4",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
Expand Down
27 changes: 27 additions & 0 deletions example/web/public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,30 @@ body {
.theoplayer-container {
z-index: 0;
}

/*
* Hack: THEOplayer's own linear ad UI is not positioned correctly by default
* when using the chromeless player.
*/
.theoplayer-ad-linear {
position: absolute;
inset: 0;
z-index: 10;
}

/*
* Hack: hide THEOplayer's built-in ad UI, so we can use our own components instead
* such as <AdCountdown /> and <AdSkipButton />.
*/
.theo-ad-remaining-container,
.theoplayer-ad-skip,
.theoplayer-ad-touch-clickthrough {
display: none !important;
}

/*
* Hack: hide overflow so that when google ima is enabled the screen won't shake furiously anymore.
*/
.theoplayer-container {
overflow-y: hidden;
}
MattiasBuelens marked this conversation as resolved.
Show resolved Hide resolved
25 changes: 10 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"react-native-builder-bob": "^0.18.0",
"react-native-google-cast": "^4.6.2",
"react-native-svg": "^13.8.0",
"react-native-theoplayer": "^2.7.0",
"react-native-theoplayer": "^3.8.0",
"release-it": "^16.2.0",
"theoplayer": "^6.5.0",
"theoplayer": "^6.9.0",
"typescript": "^4.1.3"
},
"peerDependencies": {
Expand All @@ -68,6 +68,7 @@
"react-native": "*",
"react-native-google-cast": "^4.6.2",
"react-native-svg": "^13.8.0",
"react-native-theoplayer": ">=2.7.0",
"theoplayer": ">=5.0.1"
},
"peerDependenciesMeta": {
Expand Down
33 changes: 31 additions & 2 deletions src/ui/THEOplayerDefaultUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import { MuteButton } from './components/button/MuteButton';
import { CastMessage } from './components/message/CastMessage';
import { DEFAULT_THEOPLAYER_THEME, THEOplayerTheme } from './THEOplayerTheme';
import { Platform, StyleProp, View, ViewStyle } from 'react-native';
import { UiContainer } from './components/uicontroller/UiContainer';
import { FULLSCREEN_CENTER_STYLE, UiContainer } from './components/uicontroller/UiContainer';
import { PlayButton } from './components/button/PlayButton';
import { SkipButton } from './components/button/SkipButton';
import { Spacer } from './components/controlbar/Spacer';
import { ChromecastButton } from './components/button/ChromecastButton';
import { CenteredDelayedActivityIndicator } from './components/activityindicator/CenteredDelayedActivityIndicator';
import { FULLSCREEN_CENTER_STYLE } from './components/uicontroller/UiContainer';
import { AdDisplay } from './components/ads/AdDisplay';
import { AdCountdown } from './components/ads/AdCountdown';
import { AdSkipButton } from './components/ads/AdSkipButton';
import { AdClickThroughButton } from './components/ads/AdClickThroughButton';

export interface THEOplayerDefaultUiProps {
/**
Expand Down Expand Up @@ -101,6 +104,32 @@ export function THEOplayerDefaultUi(props: THEOplayerDefaultUiProps) {
</ControlBar>
</>
}
adTop={
<>
<ControlBar>
<AdClickThroughButton />
</ControlBar>
</>
}
adCenter={
<>
<CenteredControlBar middle={<PlayButton />} />
</>
}
adBottom={
<>
<ControlBar style={{ justifyContent: 'flex-start' }}>
<AdDisplay />
<AdCountdown />
<Spacer />
<AdSkipButton />
</ControlBar>
<ControlBar>
<MuteButton />
<SeekBar />
</ControlBar>
</>
}
/>
)}
</THEOplayerView>
Expand Down
15 changes: 15 additions & 0 deletions src/ui/THEOplayerTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ export interface ColorTheme {
* The color of the dot on the seek bar.
*/
seekBarDot: string;
/**
* The color of the ad display text
*/
adDiplayText: string;
/**
* The color of the ad display background.
*/
adDisplayBackground: string;
/**
* The color of the ad skip button background.
*/
adSkipBackground: string;
}

/**
Expand Down Expand Up @@ -97,6 +109,9 @@ export const DEFAULT_THEOPLAYER_THEME: THEOplayerTheme = {
seekBarMinimum: '#FFFFFF',
seekBarMaximum: '#FFFFFF50',
seekBarDot: '#FFFFFF',
adDiplayText: '#000',
adDisplayBackground: '#FFC50F',
adSkipBackground: '#00000070',
},
text: {
textAlignVertical: 'center',
Expand Down
Loading
Loading