forked from jhomlala/betterplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/may changes 2 (jhomlala#490)
* Dash (.mpd) support for audio, quality and subtitles (jhomlala#469) * Generate DASH classes * Generate BetterPlayerDashUtils to parse .mpd files * Update data source to add Dash support * .- Make player controller support Dash format source similar to Hls. .- Update setAudioTrack method attribute type to dynamic to allow Hls or Dash audio track. * Controls get audio, quality and subtitles info from dash also. * Add name to subtitles * If label not set use language * Select by index if not label bug fixed * update version to 0.0.66 * Unify HLS and DASH with ASMS (adaptive streaming media sources) * Remove Videos from DASH and merge all video tracks in tracks adding mimetype to track * Display mimeType in quialities row if track have it. To distingue same size videos with diferent mimeTypes. * Refactor DashObject to BetterPlayerAsmsDataHolder and move to an independent file * Unify ASMS utils and setup cotroller and generate parse method with the new BetterPlayerAsmsDataHolder class as response * Added try catch to parse method * Updated DASH stream code, general fixes, code format * Updated DASH stream code, general fixes, code format * Updated readme * Fixed progress bar jumps when seeking video. * Fixed progress bar jumps when seeking video. * Fixed progress bar jumps when seeking video. * Fix end of video looping final second, and video stutter during AudioSession Deactivation (jhomlala#473) * fix: end of video looping final second * fix: vid stutter due to active I/O during AudioSession Deactivation * fix: stop audio session when no more players * Updated changelog * Updated codebase * Updated codebase Co-authored-by: Adrian <adrian@byvapps.com> Co-authored-by: Nicholas Nagy <40705372+NicholasNagy@users.noreply.github.com>
- Loading branch information
1 parent
2ea18d8
commit 7c500c6
Showing
27 changed files
with
599 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:better_player/better_player.dart'; | ||
import 'package:better_player_example/constants.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class DashPage extends StatefulWidget { | ||
@override | ||
_DashPageState createState() => _DashPageState(); | ||
} | ||
|
||
class _DashPageState extends State<DashPage> { | ||
late BetterPlayerController _betterPlayerController; | ||
|
||
@override | ||
void initState() { | ||
BetterPlayerConfiguration betterPlayerConfiguration = | ||
BetterPlayerConfiguration( | ||
aspectRatio: 16 / 9, | ||
fit: BoxFit.contain, | ||
); | ||
BetterPlayerDataSource dataSource = BetterPlayerDataSource( | ||
BetterPlayerDataSourceType.network, Constants.dashStreamUrl, | ||
useAsmsSubtitles: true, useAsmsTracks: true); | ||
_betterPlayerController = BetterPlayerController(betterPlayerConfiguration); | ||
_betterPlayerController.setupDataSource(dataSource); | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text("Dash page"), | ||
), | ||
body: Column( | ||
children: [ | ||
const SizedBox(height: 8), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
child: Text( | ||
"Player with DASH audio tracks, subtitles and tracks.", | ||
style: TextStyle(fontSize: 16), | ||
), | ||
), | ||
AspectRatio( | ||
aspectRatio: 16 / 9, | ||
child: BetterPlayer(controller: _betterPlayerController), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
///Representation of HLS / DASH audio track | ||
class BetterPlayerAsmsAudioTrack { | ||
///Audio index in DASH xml or Id of track inside HLS playlist | ||
final int? id; | ||
|
||
///segmentAlignment | ||
final bool? segmentAlignment; | ||
|
||
///Description of the audio | ||
final String? label; | ||
|
||
///Language code | ||
final String? language; | ||
|
||
///Url of audio track | ||
final String? url; | ||
|
||
///mimeType of the audio track | ||
final String? mimeType; | ||
|
||
BetterPlayerAsmsAudioTrack( | ||
{this.id, | ||
this.segmentAlignment, | ||
this.label, | ||
this.language, | ||
this.url, | ||
this.mimeType}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:better_player/src/asms/better_player_asms_audio_track.dart'; | ||
import 'package:better_player/src/asms/better_player_asms_subtitle.dart'; | ||
import 'package:better_player/src/asms/better_player_asms_track.dart'; | ||
|
||
class BetterPlayerAsmsDataHolder { | ||
List<BetterPlayerAsmsTrack>? tracks; | ||
List<BetterPlayerAsmsSubtitle>? subtitles; | ||
List<BetterPlayerAsmsAudioTrack>? audios; | ||
|
||
BetterPlayerAsmsDataHolder({this.tracks, this.subtitles, this.audios}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
///Representation of HLS / DASH subtitle element. | ||
class BetterPlayerAsmsSubtitle { | ||
///Language of the subtitle | ||
final String? language; | ||
|
||
///Name of the subtitle | ||
final String? name; | ||
|
||
///MimeType of the subtitle (DASH only) | ||
final String? mimeType; | ||
|
||
///Segment alignment (DASH only) | ||
final bool? segmentAlignment; | ||
|
||
///Url of the subtitle (master playlist) | ||
final String? url; | ||
|
||
///Urls of specific files | ||
final List<String>? realUrls; | ||
|
||
BetterPlayerAsmsSubtitle( | ||
{this.language, | ||
this.name, | ||
this.mimeType, | ||
this.segmentAlignment, | ||
this.url, | ||
this.realUrls}); | ||
} |
Oops, something went wrong.