Skip to content

Commit

Permalink
linting updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanhaevre committed Apr 25, 2024
1 parent 060e464 commit 5baa5d0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 40 deletions.
41 changes: 21 additions & 20 deletions example/src/screens/SamplePresentationModesScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {useState} from 'react';
import { useState } from 'react';
import { Text } from 'react-native';
import {
CenteredControlBar,
Expand All @@ -18,17 +18,19 @@ import {
} from '@theoplayer/react-native-ui';
import {
PlayerConfiguration,
PlayerEventType, PresentationMode, PresentationModeChangeEvent,
PlayerEventType,
PresentationMode,
PresentationModeChangeEvent,
THEOplayer,
THEOplayerView
THEOplayerView,
} from 'react-native-theoplayer';

import {Platform, SafeAreaView, StyleSheet, View} from 'react-native';
import {SourceMenuButton, SOURCES} from '../custom/SourceMenuButton';
import {PiPSubMenu} from '../custom/PipSubMenu';
import {THEO_LICENSE} from "../sampleConfig";
import { Platform, SafeAreaView, StyleSheet, View } from 'react-native';
import { SourceMenuButton, SOURCES } from '../custom/SourceMenuButton';
import { PiPSubMenu } from '../custom/PipSubMenu';
import { THEO_LICENSE } from '../sampleConfig';

const LOG_TAG = "[EXAMPLE - PRESENTATIONMODES SAMPLE]";
const LOG_TAG = '[EXAMPLE - PRESENTATIONMODES SAMPLE]';

const playerConfig: PlayerConfiguration = {
license: THEO_LICENSE,
Expand All @@ -37,16 +39,15 @@ const playerConfig: PlayerConfiguration = {

export const SamplePresentationModesScreen = () => {
const [player, setPlayer] = useState<THEOplayer | undefined>(undefined);
const [activePresentationMode, setActivePresentationMode] = useState<PresentationMode>(PresentationMode.inline
);
const [activePresentationMode, setActivePresentationMode] = useState<PresentationMode>(PresentationMode.inline);
const onPlayerReady = (player: THEOplayer) => {
console.log(LOG_TAG, 'THEOplayer is ready:', player.version);

// store player reference
setPlayer(player);

// setup debug logs
player.addEventListener<PlayerEventType>(PlayerEventType.PRESENTATIONMODE_CHANGE, (e: PresentationModeChangeEvent) => {
player.addEventListener(PlayerEventType.PRESENTATIONMODE_CHANGE, (e: PresentationModeChangeEvent) => {
console.log(LOG_TAG, `Player transitioned from ${e.previousPresentationMode} to ${e.presentationMode}.`);
setActivePresentationMode(e.presentationMode);
});
Expand All @@ -66,7 +67,7 @@ export const SamplePresentationModesScreen = () => {
<Text style={styles.TEXT}>{`Active presentationMode: ${activePresentationMode}`}</Text>
<View style={styles.PLAYER_CONTAINER_STYLE}>
<THEOplayerView config={playerConfig} onPlayerReady={onPlayerReady}>
{player !== undefined && (
{player !== undefined && (
<UiContainer
theme={{ ...DEFAULT_THEOPLAYER_THEME }}
player={player}
Expand Down Expand Up @@ -105,23 +106,23 @@ export const SamplePresentationModesScreen = () => {
</View>
</SafeAreaView>
);
}
};

const styles = StyleSheet.create({
PLAYER_CONTAINER_STYLE: {
position: 'absolute',
top: "25%",
left: "20%",
bottom: "25%",
right: "20%",
top: '25%',
left: '20%',
bottom: '25%',
right: '20%',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#000000',
},
TEXT: {
marginTop: 25,
marginHorizontal: 20,
color: "white",
textAlign: 'center'
}
color: 'white',
textAlign: 'center',
},
});
24 changes: 9 additions & 15 deletions example/src/screens/SampleSideloadedTextTrackScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {useState} from 'react';
import { useState } from 'react';
import {
CenteredControlBar,
CenteredDelayedActivityIndicator,
Expand All @@ -8,18 +8,13 @@ import {
SkipButton,
UiContainer,
} from '@theoplayer/react-native-ui';
import {
PlayerConfiguration,
PlayerEventType, TextTrackListEvent,
THEOplayer,
THEOplayerView, TrackListEventType
} from 'react-native-theoplayer';
import { PlayerConfiguration, PlayerEventType, TextTrackListEvent, THEOplayer, THEOplayerView, TrackListEventType } from 'react-native-theoplayer';

import {Platform, SafeAreaView, StyleSheet, View} from 'react-native';
import {getStatusBarHeight} from 'react-native-status-bar-height';
import {THEO_LICENSE} from "../sampleConfig";
import { Platform, SafeAreaView, StyleSheet, View } from 'react-native';
import { getStatusBarHeight } from 'react-native-status-bar-height';
import { THEO_LICENSE } from '../sampleConfig';

const LOG_TAG = "[EXAMPLE - SIDELOADED TEXTTRACK SAMPLE]";
const LOG_TAG = '[EXAMPLE - SIDELOADED TEXTTRACK SAMPLE]';

const playerConfig: PlayerConfiguration = {
license: THEO_LICENSE,
Expand Down Expand Up @@ -69,22 +64,21 @@ export const SampleSideloadedTextTrackScreen = () => {
};

// enable the textTrack, based on language (required for iOS, where default:true setup is not supported yet)
player.addEventListener<PlayerEventType>(PlayerEventType.TEXT_TRACK_LIST, (ttListEvent: TextTrackListEvent) => {
if (ttListEvent.subType === TrackListEventType.ADD_TRACK && ttListEvent.track.language === 'en') {
player.addEventListener(PlayerEventType.TEXT_TRACK_LIST, (ttListEvent: TextTrackListEvent) => {
player.selectedTextTrack = ttListEvent.track.uid;
}
});

// start playing
player.play();

};

return (
<SafeAreaView style={[StyleSheet.absoluteFill, { backgroundColor: '#000000' }]}>
<View style={styles.PLAYER_CONTAINER_STYLE}>
<THEOplayerView config={playerConfig} onPlayerReady={onPlayerReady}>
{player !== undefined && (
{player !== undefined && (
<UiContainer
theme={{ ...DEFAULT_THEOPLAYER_THEME }}
player={player}
Expand All @@ -96,7 +90,7 @@ export const SampleSideloadedTextTrackScreen = () => {
</View>
</SafeAreaView>
);
}
};

const styles = StyleSheet.create({
PLAYER_CONTAINER_STYLE: {
Expand Down
2 changes: 0 additions & 2 deletions ios/THEOplayerRCTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ public class THEOplayerRCTView: UIView {
}

private func initPlayer() -> THEOplayer? {
let stylePath = Bundle.main.path(forResource:"style", ofType: "css")
let cssPaths = stylePath != nil ? [stylePath!] : []
let config = THEOplayerConfigurationBuilder()
config.pip = self.playerPipConfiguration()
config.hlsDateRange = self.hlsDateRange
Expand Down
4 changes: 2 additions & 2 deletions src/internal/THEOplayerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ export class THEOplayerView extends PureComponent<React.PropsWithChildren<THEOpl
}

private reset() {
this.setState( prevState => ({
this.setState((prevState) => ({
...prevState,
error: undefined
error: undefined,
}));
}

Expand Down
2 changes: 1 addition & 1 deletion src/internal/adapter/WebEventForwarder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ChromelessPlayer } from 'theoplayer';
import type {
AddTrackEvent,
CastStateChangeEvent,
Expand All @@ -16,6 +15,7 @@ import type {
TimeUpdateEvent as NativeTimeUpdateEvent,
TrackChangeEvent,
VolumeChangeEvent as NativeVolumeChangeEvent,
ChromelessPlayer,
} from 'theoplayer';
import type { AdEvent, MediaTrack, TextTrack, TimeRange } from 'react-native-theoplayer';
import {
Expand Down

0 comments on commit 5baa5d0

Please sign in to comment.