unified-video-framework 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +253 -0
- package/ANDROID_TV_IMPLEMENTATION.md +313 -0
- package/COMPLETION_STATUS.md +165 -0
- package/CONTRIBUTING.md +376 -0
- package/FINAL_STATUS_REPORT.md +170 -0
- package/FRAMEWORK_REVIEW.md +247 -0
- package/IMPROVEMENTS_SUMMARY.md +168 -0
- package/LICENSE +21 -0
- package/NATIVE_APP_INTEGRATION_GUIDE.md +903 -0
- package/PAYWALL_RENTAL_FLOW.md +499 -0
- package/PLATFORM_SETUP_GUIDE.md +1636 -0
- package/README.md +315 -0
- package/RUN_LOCALLY.md +151 -0
- package/apps/demo/cast-sender-min.html +173 -0
- package/apps/demo/custom-player.html +883 -0
- package/apps/demo/demo.html +990 -0
- package/apps/demo/enhanced-player.html +3556 -0
- package/apps/demo/index.html +159 -0
- package/apps/rental-api/.env.example +24 -0
- package/apps/rental-api/README.md +23 -0
- package/apps/rental-api/migrations/001_init.sql +35 -0
- package/apps/rental-api/migrations/002_videos.sql +10 -0
- package/apps/rental-api/migrations/003_add_gateway_subref.sql +4 -0
- package/apps/rental-api/migrations/004_update_gateways.sql +4 -0
- package/apps/rental-api/migrations/005_seed_demo_video.sql +5 -0
- package/apps/rental-api/package-lock.json +2045 -0
- package/apps/rental-api/package.json +33 -0
- package/apps/rental-api/scripts/run-migration.js +42 -0
- package/apps/rental-api/scripts/update-video-currency.js +21 -0
- package/apps/rental-api/scripts/update-video-price.js +19 -0
- package/apps/rental-api/src/config.ts +14 -0
- package/apps/rental-api/src/db.ts +10 -0
- package/apps/rental-api/src/routes/cashfree.ts +167 -0
- package/apps/rental-api/src/routes/pesapal.ts +92 -0
- package/apps/rental-api/src/routes/rentals.ts +242 -0
- package/apps/rental-api/src/routes/webhooks.ts +73 -0
- package/apps/rental-api/src/server.ts +41 -0
- package/apps/rental-api/src/services/entitlements.ts +45 -0
- package/apps/rental-api/src/services/payments.ts +22 -0
- package/apps/rental-api/tsconfig.json +17 -0
- package/check-urls.ps1 +74 -0
- package/comparison-report.md +181 -0
- package/docs/PAYWALL.md +95 -0
- package/docs/PLAYER_UI_VISIBILITY.md +431 -0
- package/docs/README.md +7 -0
- package/docs/SYSTEM_ARCHITECTURE.md +612 -0
- package/docs/VDOCIPHER_CLONE_REQUIREMENTS.md +403 -0
- package/examples/android/JavaSampleApp/MainActivity.java +641 -0
- package/examples/android/JavaSampleApp/activity_main.xml +226 -0
- package/examples/android/SampleApp/MainActivity.kt +430 -0
- package/examples/ios/SampleApp/ViewController.swift +337 -0
- package/examples/ios/SwiftUISampleApp/ContentView.swift +304 -0
- package/iOS_IMPLEMENTATION_OPTIONS.md +470 -0
- package/ios/UnifiedVideoPlayer/UnifiedVideoPlayer.podspec +33 -0
- package/jest.config.js +33 -0
- package/jitpack.yml +5 -0
- package/lerna.json +35 -0
- package/package.json +69 -0
- package/packages/PLATFORM_STATUS.md +163 -0
- package/packages/android/build.gradle +135 -0
- package/packages/android/src/main/AndroidManifest.xml +36 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/PlayerConfiguration.java +221 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/UnifiedVideoPlayer.java +1037 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/UnifiedVideoPlayer.kt +707 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/analytics/AnalyticsProvider.java +9 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/cast/CastManager.java +141 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/cast/CastOptionsProvider.java +29 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/overlay/WatermarkOverlayView.java +88 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/pip/PipActionReceiver.java +33 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/services/PlaybackService.java +110 -0
- package/packages/android/src/main/java/com/unifiedvideo/player/services/PlayerHolder.java +19 -0
- package/packages/core/package.json +34 -0
- package/packages/core/src/BasePlayer.ts +250 -0
- package/packages/core/src/VideoPlayer.ts +237 -0
- package/packages/core/src/VideoPlayerFactory.ts +145 -0
- package/packages/core/src/index.ts +20 -0
- package/packages/core/src/interfaces/IVideoPlayer.ts +184 -0
- package/packages/core/src/interfaces.ts +240 -0
- package/packages/core/src/utils/EventEmitter.ts +66 -0
- package/packages/core/src/utils/PlatformDetector.ts +300 -0
- package/packages/core/tsconfig.json +20 -0
- package/packages/enact/package.json +51 -0
- package/packages/enact/src/VideoPlayer.js +365 -0
- package/packages/enact/src/adapters/TizenAdapter.js +354 -0
- package/packages/enact/src/index.js +82 -0
- package/packages/ios/BUILD_INSTRUCTIONS.md +108 -0
- package/packages/ios/FIX_EMBED_ISSUE.md +142 -0
- package/packages/ios/GETTING_STARTED.md +100 -0
- package/packages/ios/Package.swift +35 -0
- package/packages/ios/README.md +84 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/Analytics/AnalyticsEmitter.swift +26 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/DRM/FairPlayDRMManager.swift +102 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/Info.plist +24 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/Remote/RemoteCommandCenter.swift +109 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/UnifiedVideoPlayer.swift +811 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/UnifiedVideoPlayerView.swift +640 -0
- package/packages/ios/Sources/UnifiedVideoPlayer/Utilities/Color+Hex.swift +36 -0
- package/packages/ios/UnifiedVideoPlayer.podspec +27 -0
- package/packages/ios/UnifiedVideoPlayer.xcodeproj/project.pbxproj +385 -0
- package/packages/ios/build_framework.sh +55 -0
- package/packages/react-native/android/src/main/java/com/unifiedvideo/UnifiedVideoPlayerModule.kt +482 -0
- package/packages/react-native/ios/UnifiedVideoPlayer.swift +436 -0
- package/packages/react-native/package.json +51 -0
- package/packages/react-native/src/ReactNativePlayer.tsx +423 -0
- package/packages/react-native/src/VideoPlayer.tsx +224 -0
- package/packages/react-native/src/index.ts +28 -0
- package/packages/react-native/src/utils/EventEmitter.ts +66 -0
- package/packages/react-native/tsconfig.json +31 -0
- package/packages/roku/components/UnifiedVideoPlayer.brs +400 -0
- package/packages/roku/package.json +44 -0
- package/packages/roku/source/VideoPlayer.brs +231 -0
- package/packages/roku/source/main.brs +28 -0
- package/packages/web/GETTING_STARTED.md +292 -0
- package/packages/web/jest.config.js +28 -0
- package/packages/web/jest.setup.ts +110 -0
- package/packages/web/package.json +50 -0
- package/packages/web/src/SecureVideoPlayer.ts +1164 -0
- package/packages/web/src/WebPlayer.ts +3110 -0
- package/packages/web/src/__tests__/WebPlayer.test.ts +314 -0
- package/packages/web/src/index.ts +14 -0
- package/packages/web/src/paywall/PaywallController.ts +215 -0
- package/packages/web/src/react/WebPlayerView.tsx +177 -0
- package/packages/web/tsconfig.json +23 -0
- package/packages/web/webpack.config.js +45 -0
- package/server.js +131 -0
- package/server.py +84 -0
- package/test-urls.ps1 +97 -0
- package/test-video-urls.ps1 +87 -0
- package/tsconfig.json +39 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
name: CI/CD Pipeline
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
release:
|
|
9
|
+
types: [created]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
# Code quality checks
|
|
13
|
+
lint:
|
|
14
|
+
name: Lint Code
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: '18'
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: Run ESLint
|
|
29
|
+
run: npm run lint
|
|
30
|
+
|
|
31
|
+
- name: Check TypeScript
|
|
32
|
+
run: npm run type-check
|
|
33
|
+
|
|
34
|
+
# Unit tests
|
|
35
|
+
test:
|
|
36
|
+
name: Run Tests
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
strategy:
|
|
39
|
+
matrix:
|
|
40
|
+
node-version: [16, 18, 20]
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v3
|
|
43
|
+
|
|
44
|
+
- name: Setup Node.js ${{ matrix.node-version }}
|
|
45
|
+
uses: actions/setup-node@v3
|
|
46
|
+
with:
|
|
47
|
+
node-version: ${{ matrix.node-version }}
|
|
48
|
+
cache: 'npm'
|
|
49
|
+
|
|
50
|
+
- name: Install dependencies
|
|
51
|
+
run: npm ci
|
|
52
|
+
|
|
53
|
+
- name: Run tests with coverage
|
|
54
|
+
run: npm run test:coverage
|
|
55
|
+
|
|
56
|
+
- name: Upload coverage to Codecov
|
|
57
|
+
uses: codecov/codecov-action@v3
|
|
58
|
+
with:
|
|
59
|
+
file: ./coverage/coverage-final.json
|
|
60
|
+
flags: unittests
|
|
61
|
+
name: codecov-${{ matrix.node-version }}
|
|
62
|
+
|
|
63
|
+
# Build packages
|
|
64
|
+
build:
|
|
65
|
+
name: Build Packages
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
needs: [lint, test]
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v3
|
|
70
|
+
|
|
71
|
+
- name: Setup Node.js
|
|
72
|
+
uses: actions/setup-node@v3
|
|
73
|
+
with:
|
|
74
|
+
node-version: '18'
|
|
75
|
+
cache: 'npm'
|
|
76
|
+
|
|
77
|
+
- name: Install dependencies
|
|
78
|
+
run: |
|
|
79
|
+
npm ci
|
|
80
|
+
npm run bootstrap
|
|
81
|
+
|
|
82
|
+
- name: Build all packages
|
|
83
|
+
run: npm run build
|
|
84
|
+
|
|
85
|
+
- name: Upload build artifacts
|
|
86
|
+
uses: actions/upload-artifact@v3
|
|
87
|
+
with:
|
|
88
|
+
name: dist-packages
|
|
89
|
+
path: |
|
|
90
|
+
packages/*/dist
|
|
91
|
+
!packages/*/node_modules
|
|
92
|
+
|
|
93
|
+
# Platform-specific builds
|
|
94
|
+
build-platforms:
|
|
95
|
+
name: Build Platform - ${{ matrix.platform }}
|
|
96
|
+
runs-on: ${{ matrix.os }}
|
|
97
|
+
needs: build
|
|
98
|
+
strategy:
|
|
99
|
+
matrix:
|
|
100
|
+
include:
|
|
101
|
+
- platform: web
|
|
102
|
+
os: ubuntu-latest
|
|
103
|
+
- platform: ios
|
|
104
|
+
os: macos-latest
|
|
105
|
+
- platform: android
|
|
106
|
+
os: ubuntu-latest
|
|
107
|
+
- platform: roku
|
|
108
|
+
os: ubuntu-latest
|
|
109
|
+
steps:
|
|
110
|
+
- uses: actions/checkout@v3
|
|
111
|
+
|
|
112
|
+
- name: Setup Node.js
|
|
113
|
+
uses: actions/setup-node@v3
|
|
114
|
+
with:
|
|
115
|
+
node-version: '18'
|
|
116
|
+
cache: 'npm'
|
|
117
|
+
|
|
118
|
+
- name: Setup platform-specific tools
|
|
119
|
+
run: |
|
|
120
|
+
if [ "${{ matrix.platform }}" = "ios" ]; then
|
|
121
|
+
echo "Setting up iOS tools..."
|
|
122
|
+
# brew install cocoapods
|
|
123
|
+
elif [ "${{ matrix.platform }}" = "android" ]; then
|
|
124
|
+
echo "Setting up Android tools..."
|
|
125
|
+
# Setup Android SDK
|
|
126
|
+
elif [ "${{ matrix.platform }}" = "roku" ]; then
|
|
127
|
+
echo "Setting up Roku tools..."
|
|
128
|
+
# npm install -g @rokucommunity/bslint brighterscript
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
- name: Install dependencies
|
|
132
|
+
run: |
|
|
133
|
+
npm ci
|
|
134
|
+
npm run bootstrap
|
|
135
|
+
|
|
136
|
+
- name: Build ${{ matrix.platform }}
|
|
137
|
+
run: npm run build:${{ matrix.platform }}
|
|
138
|
+
continue-on-error: true # Allow failures for now since packages are incomplete
|
|
139
|
+
|
|
140
|
+
# Integration tests
|
|
141
|
+
integration:
|
|
142
|
+
name: Integration Tests
|
|
143
|
+
runs-on: ubuntu-latest
|
|
144
|
+
needs: build
|
|
145
|
+
services:
|
|
146
|
+
nginx:
|
|
147
|
+
image: nginx:alpine
|
|
148
|
+
ports:
|
|
149
|
+
- 8080:80
|
|
150
|
+
options: --health-cmd="wget -O /dev/null http://localhost || exit 1"
|
|
151
|
+
steps:
|
|
152
|
+
- uses: actions/checkout@v3
|
|
153
|
+
|
|
154
|
+
- name: Setup Node.js
|
|
155
|
+
uses: actions/setup-node@v3
|
|
156
|
+
with:
|
|
157
|
+
node-version: '18'
|
|
158
|
+
cache: 'npm'
|
|
159
|
+
|
|
160
|
+
- name: Install dependencies
|
|
161
|
+
run: |
|
|
162
|
+
npm ci
|
|
163
|
+
npm run bootstrap
|
|
164
|
+
|
|
165
|
+
- name: Download build artifacts
|
|
166
|
+
uses: actions/download-artifact@v3
|
|
167
|
+
with:
|
|
168
|
+
name: dist-packages
|
|
169
|
+
path: packages
|
|
170
|
+
|
|
171
|
+
- name: Run integration tests
|
|
172
|
+
run: npm run test:integration
|
|
173
|
+
env:
|
|
174
|
+
TEST_SERVER_URL: http://localhost:8080
|
|
175
|
+
|
|
176
|
+
# Deploy documentation
|
|
177
|
+
docs:
|
|
178
|
+
name: Deploy Documentation
|
|
179
|
+
runs-on: ubuntu-latest
|
|
180
|
+
needs: build
|
|
181
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
182
|
+
steps:
|
|
183
|
+
- uses: actions/checkout@v3
|
|
184
|
+
|
|
185
|
+
- name: Setup Node.js
|
|
186
|
+
uses: actions/setup-node@v3
|
|
187
|
+
with:
|
|
188
|
+
node-version: '18'
|
|
189
|
+
cache: 'npm'
|
|
190
|
+
|
|
191
|
+
- name: Install dependencies
|
|
192
|
+
run: npm ci
|
|
193
|
+
|
|
194
|
+
- name: Build documentation
|
|
195
|
+
run: npm run docs
|
|
196
|
+
|
|
197
|
+
- name: Deploy to GitHub Pages
|
|
198
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
199
|
+
with:
|
|
200
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
201
|
+
publish_dir: ./docs
|
|
202
|
+
|
|
203
|
+
# Publish to NPM
|
|
204
|
+
publish:
|
|
205
|
+
name: Publish to NPM
|
|
206
|
+
runs-on: ubuntu-latest
|
|
207
|
+
needs: [build, integration]
|
|
208
|
+
if: github.event_name == 'release'
|
|
209
|
+
steps:
|
|
210
|
+
- uses: actions/checkout@v3
|
|
211
|
+
|
|
212
|
+
- name: Setup Node.js
|
|
213
|
+
uses: actions/setup-node@v3
|
|
214
|
+
with:
|
|
215
|
+
node-version: '18'
|
|
216
|
+
cache: 'npm'
|
|
217
|
+
registry-url: 'https://registry.npmjs.org'
|
|
218
|
+
|
|
219
|
+
- name: Install dependencies
|
|
220
|
+
run: |
|
|
221
|
+
npm ci
|
|
222
|
+
npm run bootstrap
|
|
223
|
+
|
|
224
|
+
- name: Build packages
|
|
225
|
+
run: npm run build
|
|
226
|
+
|
|
227
|
+
- name: Publish packages
|
|
228
|
+
run: npm run publish
|
|
229
|
+
env:
|
|
230
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
231
|
+
|
|
232
|
+
# Security audit
|
|
233
|
+
security:
|
|
234
|
+
name: Security Audit
|
|
235
|
+
runs-on: ubuntu-latest
|
|
236
|
+
steps:
|
|
237
|
+
- uses: actions/checkout@v3
|
|
238
|
+
|
|
239
|
+
- name: Setup Node.js
|
|
240
|
+
uses: actions/setup-node@v3
|
|
241
|
+
with:
|
|
242
|
+
node-version: '18'
|
|
243
|
+
cache: 'npm'
|
|
244
|
+
|
|
245
|
+
- name: Run npm audit
|
|
246
|
+
run: npm audit --audit-level=moderate
|
|
247
|
+
continue-on-error: true
|
|
248
|
+
|
|
249
|
+
- name: Run Snyk security scan
|
|
250
|
+
uses: snyk/actions/node@master
|
|
251
|
+
env:
|
|
252
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
|
253
|
+
continue-on-error: true
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Android TV Implementation Strategy
|
|
2
|
+
|
|
3
|
+
## Current Gap Analysis
|
|
4
|
+
|
|
5
|
+
The framework currently lacks Android TV support because:
|
|
6
|
+
|
|
7
|
+
1. **Architecture Decision Pending**: Android TV can be implemented via multiple approaches
|
|
8
|
+
2. **Platform Overlap**: Android TV shares characteristics with both mobile (Android) and TV (webOS/Tizen) platforms
|
|
9
|
+
3. **Resource Prioritization**: Core web implementation was completed first as proof of concept
|
|
10
|
+
|
|
11
|
+
## Implementation Approaches
|
|
12
|
+
|
|
13
|
+
### Option 1: React Native TV Fork
|
|
14
|
+
```
|
|
15
|
+
packages/
|
|
16
|
+
react-native-tv/ # New package
|
|
17
|
+
src/
|
|
18
|
+
AndroidTVPlayer.tsx
|
|
19
|
+
components/
|
|
20
|
+
TVFocusGuide.tsx
|
|
21
|
+
TVRemoteHandler.tsx
|
|
22
|
+
android/
|
|
23
|
+
src/main/java/
|
|
24
|
+
com/unifiedvideo/tv/
|
|
25
|
+
TVPlayerModule.java
|
|
26
|
+
TVPlayerPackage.java
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Pros:**
|
|
30
|
+
- Leverages existing React Native knowledge
|
|
31
|
+
- Good community support (react-native-tvos)
|
|
32
|
+
- Shared codebase with mobile
|
|
33
|
+
|
|
34
|
+
**Cons:**
|
|
35
|
+
- Requires maintaining TV-specific fork
|
|
36
|
+
- Performance overhead of React Native bridge
|
|
37
|
+
|
|
38
|
+
### Option 2: Native Android TV App
|
|
39
|
+
```
|
|
40
|
+
packages/
|
|
41
|
+
android-tv/ # New package
|
|
42
|
+
src/
|
|
43
|
+
main/
|
|
44
|
+
java/
|
|
45
|
+
com/unifiedvideo/androidtv/
|
|
46
|
+
player/
|
|
47
|
+
ExoPlayerWrapper.kt
|
|
48
|
+
DRMHandler.kt
|
|
49
|
+
ui/
|
|
50
|
+
PlayerActivity.kt
|
|
51
|
+
LeanbackFragment.kt
|
|
52
|
+
res/
|
|
53
|
+
layout/
|
|
54
|
+
activity_player.xml
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Pros:**
|
|
58
|
+
- Best performance
|
|
59
|
+
- Full access to Android TV Leanback library
|
|
60
|
+
- Native ExoPlayer integration
|
|
61
|
+
|
|
62
|
+
**Cons:**
|
|
63
|
+
- Requires Kotlin/Java expertise
|
|
64
|
+
- Separate codebase from other platforms
|
|
65
|
+
|
|
66
|
+
### Option 3: Web-Based (Hybrid)
|
|
67
|
+
```
|
|
68
|
+
packages/
|
|
69
|
+
web-tv/ # Extended web package
|
|
70
|
+
src/
|
|
71
|
+
AndroidTVAdapter.ts
|
|
72
|
+
remote/
|
|
73
|
+
DPadNavigation.ts
|
|
74
|
+
RemoteControl.ts
|
|
75
|
+
focus/
|
|
76
|
+
SpatialNavigation.ts
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Pros:**
|
|
80
|
+
- Reuses existing web implementation
|
|
81
|
+
- Works on Android TV WebView
|
|
82
|
+
- Easier maintenance
|
|
83
|
+
|
|
84
|
+
**Cons:**
|
|
85
|
+
- Limited access to native features
|
|
86
|
+
- Performance constraints of WebView
|
|
87
|
+
|
|
88
|
+
## Recommended Approach
|
|
89
|
+
|
|
90
|
+
### Phase 1: Web-Based MVP (Quick Win)
|
|
91
|
+
1. Extend the web package with TV navigation
|
|
92
|
+
2. Add D-pad support and spatial navigation
|
|
93
|
+
3. Create Android TV wrapper app with WebView
|
|
94
|
+
|
|
95
|
+
### Phase 2: Native Integration
|
|
96
|
+
1. Implement native Android TV app with ExoPlayer
|
|
97
|
+
2. Add Leanback UI components
|
|
98
|
+
3. Integrate with existing core interfaces
|
|
99
|
+
|
|
100
|
+
### Phase 3: Feature Parity
|
|
101
|
+
1. Add DRM support (Widevine)
|
|
102
|
+
2. Implement advanced features (PiP, voice control)
|
|
103
|
+
3. Support for Live Channels integration
|
|
104
|
+
|
|
105
|
+
## Implementation Roadmap
|
|
106
|
+
|
|
107
|
+
### Week 1-2: Setup & Planning
|
|
108
|
+
- [ ] Choose implementation approach
|
|
109
|
+
- [ ] Set up Android TV development environment
|
|
110
|
+
- [ ] Create package structure
|
|
111
|
+
- [ ] Define API contracts
|
|
112
|
+
|
|
113
|
+
### Week 3-4: Core Player
|
|
114
|
+
- [ ] Implement basic video playback
|
|
115
|
+
- [ ] Add HLS/DASH support via ExoPlayer
|
|
116
|
+
- [ ] Handle remote control events
|
|
117
|
+
- [ ] Implement focus management
|
|
118
|
+
|
|
119
|
+
### Week 5-6: UI & Navigation
|
|
120
|
+
- [ ] Create TV-optimized UI
|
|
121
|
+
- [ ] Implement spatial navigation
|
|
122
|
+
- [ ] Add quality selection for TV
|
|
123
|
+
- [ ] Create settings screen
|
|
124
|
+
|
|
125
|
+
### Week 7-8: Advanced Features
|
|
126
|
+
- [ ] Add subtitle support
|
|
127
|
+
- [ ] Implement audio track selection
|
|
128
|
+
- [ ] Add Chromecast support
|
|
129
|
+
- [ ] Integrate analytics
|
|
130
|
+
|
|
131
|
+
### Week 9-10: Testing & Polish
|
|
132
|
+
- [ ] Test on multiple Android TV devices
|
|
133
|
+
- [ ] Performance optimization
|
|
134
|
+
- [ ] Accessibility features
|
|
135
|
+
- [ ] Documentation
|
|
136
|
+
|
|
137
|
+
## Technical Requirements
|
|
138
|
+
|
|
139
|
+
### Dependencies
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"dependencies": {
|
|
143
|
+
"com.google.android.exoplayer:exoplayer": "2.19.1",
|
|
144
|
+
"androidx.leanback:leanback": "1.2.0",
|
|
145
|
+
"androidx.tvprovider:tvprovider": "1.1.0"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Minimum Requirements
|
|
151
|
+
- Android TV 5.0 (API 21)
|
|
152
|
+
- ExoPlayer 2.x
|
|
153
|
+
- AndroidX libraries
|
|
154
|
+
|
|
155
|
+
### Key Features to Implement
|
|
156
|
+
1. **Player Core**
|
|
157
|
+
- ExoPlayer integration
|
|
158
|
+
- Adaptive streaming (HLS/DASH)
|
|
159
|
+
- DRM support (Widevine L1/L3)
|
|
160
|
+
|
|
161
|
+
2. **TV-Specific UI**
|
|
162
|
+
- Leanback launcher integration
|
|
163
|
+
- Browse fragments for content
|
|
164
|
+
- Playback overlay controls
|
|
165
|
+
|
|
166
|
+
3. **Remote Control**
|
|
167
|
+
- D-pad navigation
|
|
168
|
+
- Media buttons handling
|
|
169
|
+
- Voice search integration
|
|
170
|
+
|
|
171
|
+
4. **Performance**
|
|
172
|
+
- Hardware acceleration
|
|
173
|
+
- 4K/HDR support
|
|
174
|
+
- Low latency mode for gaming
|
|
175
|
+
|
|
176
|
+
## Sample Implementation
|
|
177
|
+
|
|
178
|
+
### Basic Android TV Player Activity
|
|
179
|
+
```kotlin
|
|
180
|
+
// packages/android-tv/src/main/java/com/unifiedvideo/androidtv/PlayerActivity.kt
|
|
181
|
+
|
|
182
|
+
class PlayerActivity : FragmentActivity() {
|
|
183
|
+
private lateinit var playerView: PlayerView
|
|
184
|
+
private lateinit var exoPlayer: ExoPlayer
|
|
185
|
+
|
|
186
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
187
|
+
super.onCreate(savedInstanceState)
|
|
188
|
+
setContentView(R.layout.activity_player)
|
|
189
|
+
|
|
190
|
+
initializePlayer()
|
|
191
|
+
handleRemoteControl()
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private fun initializePlayer() {
|
|
195
|
+
exoPlayer = ExoPlayer.Builder(this)
|
|
196
|
+
.setTrackSelector(DefaultTrackSelector(this))
|
|
197
|
+
.build()
|
|
198
|
+
|
|
199
|
+
playerView.player = exoPlayer
|
|
200
|
+
|
|
201
|
+
val mediaItem = MediaItem.fromUri(intent.getStringExtra("video_url"))
|
|
202
|
+
exoPlayer.setMediaItem(mediaItem)
|
|
203
|
+
exoPlayer.prepare()
|
|
204
|
+
exoPlayer.play()
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private fun handleRemoteControl() {
|
|
208
|
+
// D-pad and media button handling
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
|
212
|
+
return when (keyCode) {
|
|
213
|
+
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> {
|
|
214
|
+
togglePlayback()
|
|
215
|
+
true
|
|
216
|
+
}
|
|
217
|
+
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
|
218
|
+
showControls()
|
|
219
|
+
true
|
|
220
|
+
}
|
|
221
|
+
else -> super.onKeyDown(keyCode, event)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### TV-Specific Manifest
|
|
228
|
+
```xml
|
|
229
|
+
<!-- packages/android-tv/src/main/AndroidManifest.xml -->
|
|
230
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
231
|
+
|
|
232
|
+
<uses-feature
|
|
233
|
+
android:name="android.software.leanback"
|
|
234
|
+
android:required="true" />
|
|
235
|
+
|
|
236
|
+
<uses-feature
|
|
237
|
+
android:name="android.hardware.touchscreen"
|
|
238
|
+
android:required="false" />
|
|
239
|
+
|
|
240
|
+
<application
|
|
241
|
+
android:banner="@drawable/tv_banner"
|
|
242
|
+
android:icon="@mipmap/ic_launcher"
|
|
243
|
+
android:theme="@style/Theme.Leanback">
|
|
244
|
+
|
|
245
|
+
<activity
|
|
246
|
+
android:name=".MainActivity"
|
|
247
|
+
android:label="@string/app_name">
|
|
248
|
+
<intent-filter>
|
|
249
|
+
<action android:name="android.intent.action.MAIN" />
|
|
250
|
+
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
|
251
|
+
</intent-filter>
|
|
252
|
+
</activity>
|
|
253
|
+
|
|
254
|
+
<activity
|
|
255
|
+
android:name=".PlayerActivity"
|
|
256
|
+
android:configChanges="orientation|screenSize"
|
|
257
|
+
android:launchMode="singleTask"
|
|
258
|
+
android:theme="@style/Theme.Player" />
|
|
259
|
+
|
|
260
|
+
</application>
|
|
261
|
+
</manifest>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Integration with Existing Framework
|
|
265
|
+
|
|
266
|
+
### Core Interface Implementation
|
|
267
|
+
```typescript
|
|
268
|
+
// packages/android-tv/src/bridge/AndroidTVBridge.ts
|
|
269
|
+
|
|
270
|
+
import { IVideoPlayer } from '@video-framework/core';
|
|
271
|
+
|
|
272
|
+
export class AndroidTVBridge implements IVideoPlayer {
|
|
273
|
+
private native: any; // Native Android module
|
|
274
|
+
|
|
275
|
+
async load(source: VideoSource): Promise<void> {
|
|
276
|
+
return this.native.loadVideo(source.url, source.drmConfig);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async play(): Promise<void> {
|
|
280
|
+
return this.native.play();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async pause(): Promise<void> {
|
|
284
|
+
return this.native.pause();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// ... other methods
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Next Steps
|
|
292
|
+
|
|
293
|
+
1. **Immediate Actions**
|
|
294
|
+
- Decide on implementation approach based on team skills
|
|
295
|
+
- Set up Android TV emulator/device for testing
|
|
296
|
+
- Create package structure
|
|
297
|
+
|
|
298
|
+
2. **Development Priorities**
|
|
299
|
+
- Start with web-based approach for quick prototype
|
|
300
|
+
- Evaluate performance and user experience
|
|
301
|
+
- Iterate towards native implementation if needed
|
|
302
|
+
|
|
303
|
+
3. **Team Requirements**
|
|
304
|
+
- Android developer with TV experience
|
|
305
|
+
- UI/UX designer familiar with TV interfaces
|
|
306
|
+
- QA with access to various Android TV devices
|
|
307
|
+
|
|
308
|
+
## Resources
|
|
309
|
+
|
|
310
|
+
- [Android TV Developer Guide](https://developer.android.com/tv)
|
|
311
|
+
- [ExoPlayer Documentation](https://exoplayer.dev/)
|
|
312
|
+
- [Leanback Library Guide](https://developer.android.com/tv/leanback)
|
|
313
|
+
- [Android TV Design Guidelines](https://designguidelines.withgoogle.com/android-tv/)
|