nova_player 0.1.4
nova_player: ^0.1.4 copied to clipboard
A Flutter video player package with advanced analytics and interaction tracking capabilities.
Nova Player #
A Flutter video player package with advanced analytics and interaction tracking capabilities.
Features #
- Advanced video playback controls
- Comprehensive analytics tracking
- User interaction monitoring
- Watchtime tracking
- Delivery analytics
- Customizable player UI
- Support for various video formats
- Integration with analytics services
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
nova_player: ^0.1.0
Usage #
Basic Implementation #
import 'package:nova_player/nova_player.dart';
// Initialize the player
final player = NovaPlayer(
videoUrl: 'https://example.com/video.mp4',
analyticsService: AnalyticsService(),
);
// Use the player widget
NovaPlayerWidget(
player: player,
onInteraction: (interaction) {
// Handle player interactions
},
)
Advanced Implementation #
import 'package:nova_player/nova_player.dart';
class VideoPlayerScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final analyticsService = AnalyticsService();
return Scaffold(
body: NovaPlayerWidget(
player: NovaPlayer(
videoUrl: 'https://example.com/video.mp4',
analyticsService: analyticsService,
initialPosition: Duration.zero,
autoPlay: true,
),
onInteraction: (interaction) {
// Track user interactions
analyticsService.trackInteraction(
videoId: 'video123',
interaction: interaction,
);
},
onError: (error) {
// Handle player errors
print('Player error: $error');
},
),
);
}
}
Analytics Integration #
final analyticsService = AnalyticsService();
// Track watchtime
analyticsService.trackWatchtime(
videoId: 'video123',
duration: Duration(minutes: 5),
);
// Track delivery analytics
analyticsService.trackDelivery(
videoId: 'video123',
deliveryMetrics: DeliveryMetrics(
bufferTime: Duration(seconds: 2),
startupTime: Duration(seconds: 1),
),
);
// Track user interactions
analyticsService.trackInteraction(
videoId: 'video123',
interaction: PlayerInteraction(
type: InteractionType.play,
timestamp: DateTime.now(),
metadata: {
'position': '00:00:30',
'volume': '0.8',
},
),
);
API Reference #
NovaPlayer #
The main player class that handles video playback and analytics.
Properties
videoUrl: The URL of the video to playanalyticsService: The analytics service instancecontrolsBloc: The player controls bloc for managing player stateinitialPosition: The initial playback positionautoPlay: Whether to start playback automatically
AnalyticsService #
Service for tracking various analytics metrics.
Methods
trackWatchtime(): Track video watchtimetrackDelivery(): Track delivery metricstrackInteraction(): Track user interactions
PlayerInteraction #
Represents a user interaction with the player.
Properties
type: The type of interaction (play, pause, seek, etc.)timestamp: When the interaction occurredmetadata: Additional interaction data
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License #
This project is licensed under the MIT License - see the LICENSE file for details.