diff --git a/packages/video_player_avplay/lib/src/video_player_tizen.dart b/packages/video_player_avplay/lib/src/video_player_tizen.dart index 8a6c76e82..7298fd900 100644 --- a/packages/video_player_avplay/lib/src/video_player_tizen.dart +++ b/packages/video_player_avplay/lib/src/video_player_tizen.dart @@ -3,8 +3,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:async'; - import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -42,7 +40,13 @@ class VideoPlayerTizen extends VideoPlayerPlatform { message.httpHeaders = dataSource.httpHeaders; message.drmConfigs = dataSource.drmConfigs?.toMap(); message.playerOptions = dataSource.playerOptions; - message.streamingProperty = dataSource.streamingProperty; + message.streamingProperty = dataSource.streamingProperty == null + ? null + : { + for (final MapEntry entry + in dataSource.streamingProperty!.entries) + _streamingPropertyType[entry.key]!: entry.value + }; break; case DataSourceType.file: message.uri = dataSource.uri; diff --git a/packages/video_player_avplay/lib/video_player.dart b/packages/video_player_avplay/lib/video_player.dart index f54ae211f..2e84e1ad5 100644 --- a/packages/video_player_avplay/lib/video_player.dart +++ b/packages/video_player_avplay/lib/video_player.dart @@ -315,7 +315,7 @@ class VideoPlayerController extends ValueNotifier { /// Sets specific feature values for HTTP, MMS, or specific streaming engine (Smooth Streaming, HLS, DASH, DivX Plus Streaming, or Widevine). /// The available streaming properties depend on the streaming protocol or engine. /// Only for [VideoPlayerController.network]. - final Map? streamingProperty; + final Map? streamingProperty; /// **Android only**. Will override the platform's generic file format /// detection with whatever is set here. diff --git a/packages/video_player_avplay/lib/video_player_platform_interface.dart b/packages/video_player_avplay/lib/video_player_platform_interface.dart index a44ac02bc..5eb848911 100644 --- a/packages/video_player_avplay/lib/video_player_platform_interface.dart +++ b/packages/video_player_avplay/lib/video_player_platform_interface.dart @@ -224,7 +224,7 @@ class DataSource { Map? playerOptions; /// Sets specific feature values for HTTP, MMS, or specific streaming engine - Map? streamingProperty; + Map? streamingProperty; } /// The way in which the video was originally loaded. diff --git a/packages/video_player_avplay/tizen/src/media_player.cc b/packages/video_player_avplay/tizen/src/media_player.cc index e07d1b5ec..69d0608fb 100644 --- a/packages/video_player_avplay/tizen/src/media_player.cc +++ b/packages/video_player_avplay/tizen/src/media_player.cc @@ -86,8 +86,8 @@ int64_t MediaPlayer::Create(const std::string &uri, return -1; } - std::string cookie = flutter_common::GetValue(create_message.http_headers(), - "Cookie", std::string()); + std::string cookie = flutter_common::GetValue( + create_message.streaming_property(), "COOKIE", std::string()); if (!cookie.empty()) { int ret = player_set_streaming_cookie(player_, cookie.c_str(), cookie.size()); @@ -97,7 +97,7 @@ int64_t MediaPlayer::Create(const std::string &uri, } } std::string user_agent = flutter_common::GetValue( - create_message.http_headers(), "User-Agent", std::string()); + create_message.streaming_property(), "USER_AGENT", std::string()); if (!user_agent.empty()) { int ret = player_set_streaming_user_agent(player_, user_agent.c_str(), user_agent.size()); diff --git a/packages/video_player_avplay/tizen/src/plus_player.cc b/packages/video_player_avplay/tizen/src/plus_player.cc index 2618c0063..ebc6cced6 100644 --- a/packages/video_player_avplay/tizen/src/plus_player.cc +++ b/packages/video_player_avplay/tizen/src/plus_player.cc @@ -87,20 +87,12 @@ int64_t PlusPlayer::Create(const std::string &uri, return -1; } - std::string cookie = flutter_common::GetValue(create_message.http_headers(), - "Cookie", std::string()); - if (!cookie.empty()) { - SetStreamingProperty(player_, "COOKIE", cookie); - } - std::string user_agent = flutter_common::GetValue( - create_message.http_headers(), "User-Agent", std::string()); - if (!user_agent.empty()) { - SetStreamingProperty(player_, "USER_AGENT", user_agent); - } - std::string adaptive_info = flutter_common::GetValue( - create_message.streaming_property(), "ADAPTIVE_INFO", std::string()); - if (!adaptive_info.empty()) { - SetStreamingProperty(player_, "ADAPTIVE_INFO", adaptive_info); + if (create_message.streaming_property() != nullptr && + !create_message.streaming_property()->empty()) { + for (const auto &[key, value] : *create_message.streaming_property()) { + SetStreamingProperty(player_, std::get(key), + std::get(value)); + } } if (!Open(player_, uri)) { @@ -585,7 +577,7 @@ std::string PlusPlayer::GetStreamingProperty( } plusplayer::State state = GetState(player_); if (state == plusplayer::State::kNone || state == plusplayer::State::kIdle) { - LOG_ERROR("[PIE]:Player is in invalid state[%d]", state); + LOG_ERROR("[PlusPlayer]:Player is in invalid state[%d]", state); return ""; } return ::GetStreamingProperty(player_, streaming_property_type);