stormcloud-video-player 0.5.0 → 0.5.2
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/README.md +207 -3
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +6 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +6 -2
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/sdk/prebid.cjs.map +1 -1
- package/lib/sdk/prebidController.cjs.map +1 -1
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +6 -2
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ A professional video player with advanced ad integration for web applications. B
|
|
|
13
13
|
- **Cross-Platform**: Works on desktop, mobile, tablets, and smart TVs
|
|
14
14
|
- **React Ready**: Multiple React components for different use cases
|
|
15
15
|
- **TypeScript Support**: Full type definitions included
|
|
16
|
+
- **Prebid Server Support**: Server-side header bidding via OpenRTB 2.5 with zero client-side SDK
|
|
16
17
|
- **Professional Architecture**: Modular player system with lazy loading
|
|
17
18
|
|
|
18
19
|
## 🚀 Quick Start
|
|
@@ -126,6 +127,8 @@ await player.load();
|
|
|
126
127
|
|
|
127
128
|
### CDN Usage
|
|
128
129
|
|
|
130
|
+
Include the single script tag and access everything from `window.StormcloudVP`:
|
|
131
|
+
|
|
129
132
|
```html
|
|
130
133
|
<script src="https://cdn.jsdelivr.net/npm/stormcloud-video-player/dist/stormcloud-vp.min.js"></script>
|
|
131
134
|
|
|
@@ -144,6 +147,8 @@ await player.load();
|
|
|
144
147
|
</script>
|
|
145
148
|
```
|
|
146
149
|
|
|
150
|
+
All ad player types (`ima`, `hls`, `prebid`) and utilities (`createPrebidManager`, `createPrebidController`) are available on the `window.StormcloudVP` global. See the [Prebid Mode](#3-prebid-mode-server-side-header-bidding) section for a full CDN example with Prebid Server.
|
|
151
|
+
|
|
147
152
|
## 🏗️ Professional Architecture
|
|
148
153
|
|
|
149
154
|
The Stormcloud Video Player now follows a professional, modular architecture similar to react-player:
|
|
@@ -271,7 +276,8 @@ interface StormcloudPlayerProps {
|
|
|
271
276
|
// Ad player configuration
|
|
272
277
|
vastMode?: 'adstorm' | 'default'; // VAST mode: 'adstorm' (HLS player + AdStorm VAST endpoint) or 'default' (IMA SDK + /ads/web endpoint) (default: 'default')
|
|
273
278
|
vastTagUrl?: string; // Custom VAST URL (used in default mode if provided; when not provided, uses /ads/web endpoint)
|
|
274
|
-
adPlayerType?: 'ima' | 'hls'; // Manual override for ad player type (auto-determined by vastMode if not specified)
|
|
279
|
+
adPlayerType?: 'ima' | 'hls' | 'prebid'; // Manual override for ad player type (auto-determined by vastMode if not specified)
|
|
280
|
+
prebid?: PrebidConfig; // Prebid Server configuration (required when adPlayerType is 'prebid')
|
|
275
281
|
|
|
276
282
|
// Event handlers
|
|
277
283
|
onReady?: (player: StormcloudVideoPlayer) => void;
|
|
@@ -358,7 +364,8 @@ interface StormcloudVideoPlayerConfig {
|
|
|
358
364
|
// Ad configuration
|
|
359
365
|
vastMode?: 'adstorm' | 'default'; // VAST mode: 'adstorm' (uses HLS player + AdStorm VAST endpoint) or 'default' (uses Google IMA SDK + /ads/web endpoint) (default: 'default')
|
|
360
366
|
vastTagUrl?: string; // Custom VAST tag URL (used in default mode if provided; when not provided, defaults to /ads/web endpoint)
|
|
361
|
-
adPlayerType?: 'ima' | 'hls'; // Manual override for ad player type (auto-determined by vastMode if not specified)
|
|
367
|
+
adPlayerType?: 'ima' | 'hls' | 'prebid'; // Manual override for ad player type (auto-determined by vastMode if not specified)
|
|
368
|
+
prebid?: PrebidConfig; // Prebid Server configuration (required when adPlayerType is 'prebid')
|
|
362
369
|
|
|
363
370
|
onVolumeToggle?: () => void; // Callback for volume toggle
|
|
364
371
|
onFullscreenToggle?: () => void; // Callback for fullscreen toggle
|
|
@@ -503,6 +510,187 @@ const player = new StormcloudVideoPlayer({
|
|
|
503
510
|
- ✅ Backward compatible with existing VAST tags
|
|
504
511
|
- ✅ Supports both custom VAST URLs and AdStorm backend
|
|
505
512
|
|
|
513
|
+
#### 3. **Prebid Mode** (Server-Side Header Bidding)
|
|
514
|
+
|
|
515
|
+
Uses Prebid Server for server-side header bidding auctions. The player sends OpenRTB requests directly to a Prebid Server instance, receives bid responses with VAST creatives, and plays the winning ad — all without any external SDK.
|
|
516
|
+
|
|
517
|
+
**Vanilla JavaScript:**
|
|
518
|
+
|
|
519
|
+
```javascript
|
|
520
|
+
const player = new StormcloudVideoPlayer({
|
|
521
|
+
videoElement: video,
|
|
522
|
+
src: "https://your-stream.com/playlist.m3u8",
|
|
523
|
+
licenseKey: "your-license-key",
|
|
524
|
+
|
|
525
|
+
adPlayerType: 'prebid',
|
|
526
|
+
prebid: {
|
|
527
|
+
enabled: true,
|
|
528
|
+
serverUrl: "https://prebid-server.example.com",
|
|
529
|
+
timeout: 3000,
|
|
530
|
+
debug: true,
|
|
531
|
+
cpmFloor: 0.50,
|
|
532
|
+
ortbRequest: {
|
|
533
|
+
id: "my-video-player",
|
|
534
|
+
imp: [
|
|
535
|
+
{
|
|
536
|
+
id: "video-imp-1",
|
|
537
|
+
video: {
|
|
538
|
+
w: 640,
|
|
539
|
+
h: 480,
|
|
540
|
+
mimes: ["video/mp4", "application/x-mpegURL"],
|
|
541
|
+
protocols: [2, 5],
|
|
542
|
+
minduration: 5,
|
|
543
|
+
maxduration: 60,
|
|
544
|
+
linearity: 1,
|
|
545
|
+
playbackmethod: [1, 2],
|
|
546
|
+
},
|
|
547
|
+
ext: {
|
|
548
|
+
prebid: {
|
|
549
|
+
bidder: {
|
|
550
|
+
appnexus: { placement_id: 12345 },
|
|
551
|
+
rubicon: { account_id: 1001, site_id: 2002, zone_id: 3003 },
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
],
|
|
557
|
+
tmax: 3000,
|
|
558
|
+
site: {
|
|
559
|
+
domain: "example.com",
|
|
560
|
+
page: "https://example.com/video-page",
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
|
|
565
|
+
debugAdTiming: true,
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
await player.load();
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
**CDN Usage:**
|
|
572
|
+
|
|
573
|
+
```html
|
|
574
|
+
<video id="video" style="width:100%;aspect-ratio:16/9"></video>
|
|
575
|
+
|
|
576
|
+
<script src="https://cdn.jsdelivr.net/npm/stormcloud-video-player/dist/stormcloud-vp.min.js"></script>
|
|
577
|
+
<script>
|
|
578
|
+
var StormcloudVideoPlayer = window.StormcloudVP.StormcloudVideoPlayer;
|
|
579
|
+
|
|
580
|
+
var video = document.getElementById("video");
|
|
581
|
+
|
|
582
|
+
var player = new StormcloudVideoPlayer({
|
|
583
|
+
videoElement: video,
|
|
584
|
+
src: "https://your-stream.com/playlist.m3u8",
|
|
585
|
+
autoplay: true,
|
|
586
|
+
muted: true,
|
|
587
|
+
licenseKey: "your-license-key",
|
|
588
|
+
|
|
589
|
+
adPlayerType: "prebid",
|
|
590
|
+
prebid: {
|
|
591
|
+
enabled: true,
|
|
592
|
+
serverUrl: "https://prebid-server.example.com",
|
|
593
|
+
timeout: 3000,
|
|
594
|
+
debug: true,
|
|
595
|
+
cpmFloor: 0.50,
|
|
596
|
+
ortbRequest: {
|
|
597
|
+
id: "my-video-player",
|
|
598
|
+
imp: [
|
|
599
|
+
{
|
|
600
|
+
id: "video-imp-1",
|
|
601
|
+
video: {
|
|
602
|
+
w: 640,
|
|
603
|
+
h: 480,
|
|
604
|
+
mimes: ["video/mp4", "application/x-mpegURL"],
|
|
605
|
+
protocols: [2, 5],
|
|
606
|
+
minduration: 5,
|
|
607
|
+
maxduration: 60,
|
|
608
|
+
linearity: 1,
|
|
609
|
+
playbackmethod: [1, 2],
|
|
610
|
+
},
|
|
611
|
+
ext: {
|
|
612
|
+
prebid: {
|
|
613
|
+
bidder: {
|
|
614
|
+
appnexus: { placement_id: 12345 },
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
tmax: 3000,
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
|
|
624
|
+
debugAdTiming: true,
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
player.load();
|
|
628
|
+
</script>
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
**What happens:**
|
|
632
|
+
- Sends OpenRTB 2.5 auction requests directly to your Prebid Server
|
|
633
|
+
- Receives bid responses with VAST URLs (cached via Prebid Server) or inline VAST XML
|
|
634
|
+
- Automatically selects the highest-CPM winning bid
|
|
635
|
+
- Enforces CPM floor pricing (bids below the floor are rejected)
|
|
636
|
+
- Plays the winning ad creative natively (MP4 or HLS)
|
|
637
|
+
- Fires all VAST tracking events (impression, quartiles, complete, error, pause/resume, mute/unmute)
|
|
638
|
+
|
|
639
|
+
**Auction Flow:**
|
|
640
|
+
1. Player builds an OpenRTB request with device/site info auto-populated from the browser
|
|
641
|
+
2. Request is sent to `{serverUrl}/openrtb2/auction` via POST
|
|
642
|
+
3. Prebid Server runs the server-side auction across all configured bidders
|
|
643
|
+
4. Player parses the response, selects the highest-CPM bid
|
|
644
|
+
5. VAST creative (cached URL or inline XML) is loaded and played
|
|
645
|
+
|
|
646
|
+
**Benefits:**
|
|
647
|
+
- Zero external SDK dependencies (no Google IMA, no Prebid.js client-side library)
|
|
648
|
+
- Full server-side auction — lower client-side resource usage
|
|
649
|
+
- Support for any Prebid Server bidder (AppNexus, Rubicon, Index Exchange, etc.)
|
|
650
|
+
- CPM floor enforcement on the client side
|
|
651
|
+
- Native VAST ad playback with full tracking support
|
|
652
|
+
- Works on all platforms including Smart TVs and legacy browsers
|
|
653
|
+
- Complete OpenRTB 2.5 compliance
|
|
654
|
+
|
|
655
|
+
### PrebidConfig Reference
|
|
656
|
+
|
|
657
|
+
```typescript
|
|
658
|
+
interface PrebidConfig {
|
|
659
|
+
enabled?: boolean; // Enable/disable prebid (default: true)
|
|
660
|
+
serverUrl?: string; // Prebid Server URL (e.g. "https://prebid-server.example.com")
|
|
661
|
+
ortbRequest: { // OpenRTB 2.5 request template
|
|
662
|
+
id: string; // Request ID (will be made unique per auction)
|
|
663
|
+
imp: [{ // Impression objects (at least one required)
|
|
664
|
+
id: string;
|
|
665
|
+
video?: {
|
|
666
|
+
w?: number; // Video width
|
|
667
|
+
h?: number; // Video height
|
|
668
|
+
mimes?: string[]; // Supported MIME types
|
|
669
|
+
protocols?: number[];
|
|
670
|
+
minduration?: number;
|
|
671
|
+
maxduration?: number;
|
|
672
|
+
linearity?: number;
|
|
673
|
+
playbackmethod?: number[];
|
|
674
|
+
};
|
|
675
|
+
ext?: {
|
|
676
|
+
prebid?: {
|
|
677
|
+
bidder: { // Bidder configurations
|
|
678
|
+
[bidderName: string]: Record<string, any>;
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
}];
|
|
683
|
+
tmax?: number; // Auction timeout in ms (default: 3000)
|
|
684
|
+
site?: Record<string, any>; // Auto-populated from window.location if omitted
|
|
685
|
+
device?: Record<string, any>; // Auto-populated from navigator if omitted
|
|
686
|
+
ext?: Record<string, any>;
|
|
687
|
+
};
|
|
688
|
+
timeout?: number; // Client-side fetch timeout in ms (default: 3000)
|
|
689
|
+
debug?: boolean; // Enable debug logging (default: false)
|
|
690
|
+
cpmFloor?: number; // Minimum CPM to accept a bid (default: 0, accepts all)
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
506
694
|
### Ad Pod Generation (Multiple Consecutive Ads)
|
|
507
695
|
|
|
508
696
|
The player automatically generates **ad pods** (multiple ads played consecutively) from a single VAST URL. This works differently for VOD and live streams:
|
|
@@ -641,6 +829,7 @@ const player = new StormcloudVideoPlayer({
|
|
|
641
829
|
**Note:** When `adPlayerType` is manually set, the `vastMode` property still determines which backend endpoint is called:
|
|
642
830
|
- `vastMode: 'adstorm'` → Always calls `/vast/{licenseKey}` endpoint
|
|
643
831
|
- `vastMode: 'default'` → Calls `/ads/web` endpoint (unless `vastTagUrl` is provided)
|
|
832
|
+
- `adPlayerType: 'prebid'` → Bypasses `vastMode` entirely; VAST URLs are sourced from Prebid Server auctions (requires `prebid` config)
|
|
644
833
|
|
|
645
834
|
### SCTE-35 Support
|
|
646
835
|
|
|
@@ -984,7 +1173,11 @@ src/
|
|
|
984
1173
|
├── ui/
|
|
985
1174
|
│ └── StormcloudVideoPlayer.tsx # Legacy React component
|
|
986
1175
|
├── sdk/
|
|
987
|
-
│
|
|
1176
|
+
│ ├── ima.ts # Google IMA integration
|
|
1177
|
+
│ ├── hlsAdPlayer.ts # HLS ad player (AdStorm mode)
|
|
1178
|
+
│ ├── prebid.ts # Prebid Server auction manager
|
|
1179
|
+
│ ├── prebidController.ts # Prebid ad controller (VAST playback + tracking)
|
|
1180
|
+
│ └── vastParser.ts # VAST XML parser
|
|
988
1181
|
├── utils/
|
|
989
1182
|
│ ├── tracking.ts # Analytics and tracking
|
|
990
1183
|
│ └── index.ts # Utility functions
|
|
@@ -1102,6 +1295,17 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
1102
1295
|
|
|
1103
1296
|
Built with ❤️ by the Stormcloud team
|
|
1104
1297
|
|
|
1298
|
+
### What's New in v0.5
|
|
1299
|
+
|
|
1300
|
+
- **Prebid Server Integration**: New `adPlayerType: 'prebid'` mode for server-side header bidding via Prebid Server (OpenRTB 2.5)
|
|
1301
|
+
- **Zero-SDK Ad Auctions**: Run server-side auctions across multiple bidders (AppNexus, Rubicon, Index Exchange, etc.) without any client-side ad SDK
|
|
1302
|
+
- **PrebidConfig**: Full OpenRTB 2.5 request configuration with auto-populated device/site fields
|
|
1303
|
+
- **CPM Floor Enforcement**: Client-side floor pricing to reject bids below a minimum CPM threshold
|
|
1304
|
+
- **Native VAST Playback**: Winning bid creatives (cached VAST URL or inline VAST XML) played natively with full tracking (impression, quartiles, complete, pause/resume, mute/unmute, error)
|
|
1305
|
+
- **Smart Media Selection**: Automatic selection of the best ad media file based on the main stream's current resolution and bitrate
|
|
1306
|
+
- **HLS Ad Creatives**: Support for HLS-format ad creatives alongside MP4, with automatic format detection
|
|
1307
|
+
- **CDN-Ready**: Full prebid support available via CDN (`window.StormcloudVP.StormcloudVideoPlayer`) with no build step required
|
|
1308
|
+
|
|
1105
1309
|
### What's New in v0.4
|
|
1106
1310
|
|
|
1107
1311
|
- 🚀 **Early Ad Prefetching**: Detects SCTE-35 markers in manifest fragments before playback reaches them, prefetching ads in advance for zero-delay ad starts
|