Flutter Как установить готовый ie в плагин видео плеер - PullRequest
0 голосов
/ 20 марта 2020

Возникла проблема с настройкой DefaultHttpDataSourceFactory в плагине флаттера видеоплеера. На самом деле я играю AWS CloudFront M3U8 видео файл с подписанным поваром ie Я не могу правильно настроить повар ie.

URL потока: https://example.net/video/master.m3u8

В файле: android / src / main / java / io / flutter / plugins / videoplayer / VideoPlayer. java

....
 VideoPlayer(
      Context context,
      EventChannel eventChannel,
      TextureRegistry.SurfaceTextureEntry textureEntry,
      String dataSource,
      Result result,
      String formatHint) {
    this.eventChannel = eventChannel;
    this.textureEntry = textureEntry;

    TrackSelector trackSelector = new DefaultTrackSelector();
    exoPlayer = ExoPlayerFactory.newSimpleInstance(context, trackSelector);

    Uri uri = Uri.parse(dataSource);
    DataSource.Factory dataSourceFactory;
    if (isHTTP(uri)) {
      dataSourceFactory =
          new DefaultHttpDataSourceFactory(
              "ExoPlayer",
              null,
              DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
              DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
              true);
    } else {

     //here setting the cookie values

      DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory("ExoPlayer", null, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, true);
      httpDataSourceFactory.setDefaultRequestProperty("CloudFront-Policy","eyJTdGF0ZW1lbnQiOkZnJvbnQubmV0LyoiLCJDb2MjA3MDAxOTh9fX1dfQ__");
      httpDataSourceFactory.setDefaultRequestProperty("CloudFront-Signature","j0c8xdJqLEeF9xCRd4C~-9-J3KLA6vsLMZf-wfvSXtKhDatr3hXDCZ4yjIedlRs-7qTFTeVzKeg9lG0D0VROjzx1aMUe3NsphOPBOZJduw7mULOwS-OeTvd3AtGeU7du0B4LFN-utVntooBwSFesthLQ__");
      httpDataSourceFactory.setDefaultRequestProperty("CloudFront-Key-Pair-Id","AHJKAINYJDNGHTDX7V5BA");
      dataSourceFactory = new DefaultDataSourceFactory(context, "ExoPlayer",httpDataSourceFactory);
    }

    MediaSource mediaSource = buildMediaSource(uri, dataSourceFactory, formatHint, context);
    exoPlayer.prepare(mediaSource);

    setupVideoPlayer(eventChannel, textureEntry, result);
  }
......

Ошибка при получении например:

PlatformException (VideoError, Ошибка проигрывателя видео com.google. android .exoplayer2.ExoPlaybackException: com.google. android .exoplayer2.upstream.HttpDataSource $ InvalidResponseCodeException: Код ответа: 403, null)

Итак, помогите мне с этим, как установить и воспроизвести видео от подписанного повара ie

Заранее спасибо

...