@@ -298,6 +298,9 @@ pub struct Player {
298
298
#[ allow( unused) ]
299
299
player_runtime : PlayerRuntime ,
300
300
301
+ /// Whether we're emulating the release or the debug build.
302
+ player_mode : PlayerMode ,
303
+
301
304
swf : Arc < SwfMovie > ,
302
305
303
306
run_state : RunState ,
@@ -2179,6 +2182,7 @@ impl Player {
2179
2182
2180
2183
let mut update_context = UpdateContext {
2181
2184
player_version : this. player_version ,
2185
+ player_mode : this. player_mode ,
2182
2186
swf : & mut this. swf ,
2183
2187
library,
2184
2188
rng : & mut this. rng ,
@@ -2454,6 +2458,7 @@ pub struct PlayerBuilder {
2454
2458
gamepad_button_mapping : HashMap < GamepadButton , KeyCode > ,
2455
2459
player_version : Option < u8 > ,
2456
2460
player_runtime : PlayerRuntime ,
2461
+ player_mode : PlayerMode ,
2457
2462
quality : StageQuality ,
2458
2463
page_url : Option < String > ,
2459
2464
frame_rate : Option < f64 > ,
@@ -2505,6 +2510,7 @@ impl PlayerBuilder {
2505
2510
gamepad_button_mapping : HashMap :: new ( ) ,
2506
2511
player_version : None ,
2507
2512
player_runtime : PlayerRuntime :: default ( ) ,
2513
+ player_mode : PlayerMode :: default ( ) ,
2508
2514
quality : StageQuality :: High ,
2509
2515
page_url : None ,
2510
2516
frame_rate : None ,
@@ -2679,6 +2685,12 @@ impl PlayerBuilder {
2679
2685
self
2680
2686
}
2681
2687
2688
+ /// Configures the player mode (default is `PlayerMode::Release`)
2689
+ pub fn with_player_mode ( mut self , mode : PlayerMode ) -> Self {
2690
+ self . player_mode = mode;
2691
+ self
2692
+ }
2693
+
2682
2694
// Configure the embedding page's URL (if applicable)
2683
2695
pub fn with_page_url ( mut self , page_url : Option < String > ) -> Self {
2684
2696
self . page_url = page_url;
@@ -2859,6 +2871,7 @@ impl PlayerBuilder {
2859
2871
instance_counter : 0 ,
2860
2872
player_version,
2861
2873
player_runtime : self . player_runtime ,
2874
+ player_mode : self . player_mode ,
2862
2875
run_state : if self . autoplay {
2863
2876
RunState :: Playing
2864
2877
} else {
@@ -3043,3 +3056,11 @@ impl FromStr for PlayerRuntime {
3043
3056
Ok ( player_runtime)
3044
3057
}
3045
3058
}
3059
+
3060
+ #[ derive( Default , Clone , Copy , Debug , Eq , PartialEq ) ]
3061
+ #[ cfg_attr( feature = "serde" , derive( serde:: Deserialize ) ) ]
3062
+ pub enum PlayerMode {
3063
+ #[ default]
3064
+ Release ,
3065
+ Debug ,
3066
+ }
0 commit comments