flutter icon indicating copy to clipboard operation
flutter copied to clipboard

[video_player] Can't Change HSL Video Quilty

Open jstbyte opened this issue 5 years ago • 13 comments

“HLS”, “MPEG-DASH” Adaptive Bitrate Streaming

Quality Change Features Need.

jstbyte avatar Jun 06 '20 09:06 jstbyte

Hi @A29sTech Can you please the feature request/bug in detail? We need more information Thank you

TahaTesser avatar Jun 08 '20 09:06 TahaTesser

Flutter video plugin, m3u8 video supports Adaptive Bitrate Streaming. And it's video quality can be changed. But In m3u8 video Metadata come with all information Like video quality 240p, 360p, 720p, 1080p Etc. How can I choose video quality manually. There is no way to change video quality manually in flutter video plugin. Thanks for response.

M3u8 video resolution can't change. M3u8 video Bitrate can't change.

jstbyte avatar Jun 09 '20 01:06 jstbyte

I need same feature please tell us how to switch quality of hls while playing video and also to download video by selecting quality

talhakhan011 avatar Jul 20 '20 08:07 talhakhan011

Is the default behaviour of flutter video_player to automatically use adaptive bitrate? Or does it just choose a quality and stick to it, when using hls?

safield avatar Dec 03 '20 23:12 safield

I also need the same feature for adaptive quality for hls encoded files. Is there any update on this feature request?

rahulynot avatar Jul 11 '21 08:07 rahulynot

// M3U8 Data Setup Future<List<M3U8pass>> getM3U8(String video) async { Logging.log("---- m3u8 fitch start ----\n$video\n--- please wait –––"); return await m3u8video(video); }

// Future<M3U8s> m3u8video(String video) async { Future<List<M3U8pass>> m3u8video(String video) async { // m3u8 temp data String m3u8Content; List<M3U8pass> qualities = <M3U8pass>[]; //qualities.add(M3U8pass(dataQuality: "Auto", dataURL: video)); RegExp regExp = new RegExp( r"#EXT-X-STREAM-INF:(?:.,RESOLUTION=(\d+x\d+))?,?(.)\r?\n(.*)", caseSensitive: false, multiLine: true, );

if (m3u8Content != null) {
  Logging.log("--- HLS Old Data ----\n$m3u8Content");
  m3u8Content = null;
}
if (m3u8Content == null && video != null) {
  http.Response response = await http.get(Uri.parse(video));
  if (response.statusCode == 200) {
    m3u8Content = utf8.decode(response.bodyBytes);
  }
}

List<RegExpMatch> matches = regExp.allMatches(m3u8Content).toList();
Logging.log("--- HLS Data ----\n$m3u8Content\nfinish");

matches.forEach(
  (RegExpMatch regExpMatch) async {
    String quality = (regExpMatch.group(1)).toString();
    String sourceURL = (regExpMatch.group(3)).toString();
    final netRegex = new RegExp(r'^(http|https):\/\/([\w.]+\/?)\S*');
    final netRegex2 = new RegExp(r'(.*)\r?\/');
    final isNetwork = netRegex.hasMatch(sourceURL);
    final match = netRegex2.firstMatch(video);
    String url;
    if (isNetwork) {
      url = sourceURL;
    } else {
      Logging.log(match);
      final dataURL = match.group(0);
      url = "$dataURL$sourceURL";
      Logging.log("--- hls child url integration ---\nchild url :$url");
    }
    Logging.log('qualityVideo');
    Logging.log(quality);
    Logging.log('sourceURL');
    Logging.log(sourceURL);
    qualities.add(M3U8pass(dataQuality: quality, dataURL: url));
  },
);
return qualities;

}

image z2759830420878_3e4f5898ef1d96ca970507f43551c4fa

thanhit93 avatar Sep 13 '21 15:09 thanhit93

@thanhit93 How you changed the URL runtime of VideoController?

pratik-7span avatar Sep 30 '21 07:09 pratik-7span

we are looking for adaptive quality also like we can set quality somehow, we hope anyone can support to make it

diegothucao avatar Mar 16 '22 05:03 diegothucao

I think we need an additional function for changing the video's bitrate. I created a PR for the setBitrate function. Please check if it's good to go further.

apieceofcode1801 avatar Mar 22 '22 10:03 apieceofcode1801

thanks @apieceofcode1801 Do you add custom control for that also like if we set Birates so we have a menu to select ?

diegothucao avatar Mar 22 '22 11:03 diegothucao

@diegothucao I'm not familiar with android programming, so it may take time to complete with native code approaching. I'm implementing another approach that processes the qualities from HLS m3u8 file then loads them to the player. Users can choose from the quality list. This approach was referred from yoyo_player package. You can check this repo.

apieceofcode1801 avatar Mar 24 '22 04:03 apieceofcode1801

I forked the main flutter/plugins and add the function setBitrate to it. If you want, you can try to add it to your pubspec.yaml.

video_player: 
    git:
      url: [email protected]:apieceofcode1801/plugins.git
      ref: main
      path: packages/video_player/video_player

apieceofcode1801 avatar Apr 22 '22 15:04 apieceofcode1801

Any news regarding selecting video quality manually from HLS and Dash playlist?

AhmedAbouelkher avatar Aug 08 '22 13:08 AhmedAbouelkher

To add to this, besides setting it manually, it would be nice to be able to set a range (eg. min and max) regardless what the HLS file offers.

adamk22 avatar Oct 30 '23 15:10 adamk22

Any prominent solution for changing video quality ?

bharatbudhori avatar Nov 13 '23 09:11 bharatbudhori

How long should we wait for this?

Saeeed-B avatar Dec 03 '23 13:12 Saeeed-B

Actually there's a way to work around this issue, we can alter the URL for achieving different video quality.

bharatbudhori avatar Dec 04 '23 08:12 bharatbudhori