Toad06
b62ca3d589
web: Move `allowScriptAccess` to `BaseLoadOptions`
2021-01-30 16:59:58 -08:00
relrelb
7431cd9b10
core: Merge InputBackend into UiBackend
2021-01-30 16:36:45 -08:00
Mike Welsh
008f0f596c
core: Clip event slices are from parent movie in PlaceObject
...
Since 19034b7
, clip event scripts are returned as slices from the
SWF. This caused a panic when a movie was loaded into a clip,
because the loaded clip's `movie` would be used as the source for
clip events. However, clip events are placed by the parent's
PlaceObject tags, so the movie in this case should be the parent's
movie.
Fixes #2870 .
2021-01-28 16:36:42 -08:00
Mads Marquart
bb4240ad1f
chore: Add a few comments about unsafe usage
2021-01-28 14:39:35 -08:00
Mike Welsh
a4699a3ca5
audio: Sound transforms apply to stream sounds
...
This unifies the code path for event sounds and stream sounds.
Both `AudioBackend::start_stream` and `start_sound` return a
`SoundHandle`. `stop_stream` is removed (`stop_sound` can be
used for both cases).
Also removes references to `CharacterId` from the `AudioBackend`
(instead, an increasing ID is returned to identiy streams while
loading).
2021-01-27 15:25:04 -08:00
Mike Welsh
95ce2abf17
audio: Remove AudioBackend::stop_sounds_with_handle/is_sound_playing_with_handle
2021-01-27 15:25:04 -08:00
Mike Welsh
da2dd3b36c
core: Implement sound transforms and Sound.setPan
2021-01-27 15:25:04 -08:00
Mike Welsh
34f60b127a
core: Add AudioManager to handle actively playing sounds
...
Add an AudioManager struct to handle this list of actively playing
sounds. This will maintain information for each sound instance,
such as the owning display object, AVM1 object, etc.
This will allow us to implement the awkward AVM1 Sound API in a
fairly backend-agnostic way.
2021-01-27 15:25:04 -08:00
Omar Shehata
218f1f1da5
web: Pause player when tab is inactive ( close #347 )
2021-01-26 22:34:43 -08:00
Mike Welsh
78f85d96f0
chore: Remove some debug spew
2021-01-21 18:22:42 -08:00
Adrian Wielgosik
b69e17bf35
web: Allow customizing log level
2021-01-19 18:10:35 -08:00
Mike Welsh
da1e2801a2
chore: Appease clippy
2021-01-18 21:23:50 -08:00
Toad06
5ed30303eb
web: Remove event listeners when a Ruffle instance is destroyed
2021-01-14 13:06:37 -08:00
Mike Welsh
9bb36885bb
web: Add backgroundColor option and support bgcolor attribute
...
Add `backgroundColor` setting to the config options, allowing
a user to override the background color of an SWF. The polyfill
will now look for the `bgcolor` HTML attribute on the embed
and fill in this setting appropriately.
2021-01-13 11:57:19 -08:00
Toad06
0d7f64aa67
web: Only run JS scripts when `allowScriptAccess` is true
2021-01-11 13:16:00 -08:00
Toad06
7480e836ec
web: Changes from review
2021-01-11 13:16:00 -08:00
Toad06
0131665149
web: Fix clippy
2021-01-11 13:16:00 -08:00
Toad06
f48d5b424b
web: Fixes and improvements in `navigate_to_url`
2021-01-11 13:16:00 -08:00
TÖRÖK Attila
cce3a8199d
web: Add a config option to disable the message about unsupported content
2021-01-10 16:02:23 -08:00
Mike Welsh
01aca9f861
web: Remove upgrade_to_https param from Ruffle::new
...
Grab it from the `config` directly instead of using an extra param.
2021-01-07 11:46:07 -08:00
Mike Welsh
8728804f28
web: Add letterbox config option
2021-01-07 11:46:07 -08:00
Mike Welsh
e9da6a13f0
core: Add letterbox setting
...
Player::set_letterbox can be used to control the letterbox behavior.
* Letterbox::Off => no letterbox (flash behavior)
* Letterbox::Fullscreen => letterbox only in fullscreen (web default)
* Letterbox::On => always letterbox (desktop default)
2021-01-07 11:46:07 -08:00
Mike Welsh
e6614a8527
web: Avoid panic on fetching invalid URLs
2020-12-31 16:36:02 -08:00
Mike Welsh
972e743e34
web: Flush shared objects in unload intead of beforeunload
...
Fix part of #2092 . A panic could occur if content navigated away
using getURL, which could trigger the shared object flush while
the frame was still executing. Move the flush to "unload" so that
it occurs after execution is complete.
2020-12-27 14:01:42 -08:00
Sam Morrow
38bdb8b39a
web/desktop: Add basic dialog handling ( closes #1978 )
2020-12-23 19:08:18 -08:00
Mike Welsh
367404ddd8
core: SharedObjects are bucketed by domain
...
Key SharedObjects on the domain and path where the SWF is hosted,
and implement the localPath and secure parameters.
Fix #855 .
2020-12-22 14:18:06 -08:00
Mike Welsh
739af3f8d7
web: Flush shared objects on page unload
2020-12-21 21:46:45 -08:00
Sam Morrow
c4d7b24629
web: Fix cors issues with http (close ruffle-rs#1486)
2020-12-14 05:51:28 -08:00
Mike Welsh
7e35d4a4fc
web: Ensure parent window/frame gets focus on click ( fix #1704 )
...
Call window.focus() on mouse down to ensure the player receives
subsequent key/mouse events when it is inside a frame.
2020-12-10 19:20:00 -08:00
Mike Welsh
3bafee63a6
web: Fix spurious keyUp events ( fix #1886 )
2020-12-08 21:12:59 -08:00
Mike Welsh
b76d76d244
web: Properly handle multibyte characters in text input
...
We were checking for byte length == 1 instead of # of characters
to determine if a keyboard key was a single printable character.
Thanks to @JMcKiern for pointing this out.
2020-12-05 23:19:57 -08:00
Mike Welsh
dafe7e5027
avm1: Implement Key.getAscii
2020-11-29 02:31:10 -08:00
Mike Welsh
e655cf0c08
web: Add Ruffle::audio_context getter
2020-11-24 16:36:33 -08:00
Nathan Adams
5b5091b4b9
web: Rename copy_to_audio_buffer to copyToAudioBuffer
2020-11-24 16:36:33 -08:00
Nathan Adams
3ad4c0f392
web: Rename RufflePlayer.on_callback_available to
...
RufflePlayer.onCallbackAvailable
2020-11-24 16:36:33 -08:00
Nathan Adams
8abb8df299
web: core no longer uses webpack, but selfhosted still does
2020-11-24 16:36:33 -08:00
Nathan Adams
5ff7168fe9
web: Switched core package from javascript to typescript
2020-11-24 16:36:33 -08:00
Mike Welsh
d13a95eafa
web: Fail gracefully if LocalStorage is unavailable ( fix #1590 )
2020-11-19 22:51:02 -08:00
relrelb
9068322d24
web: Retain focus on fullscreen enter/exit
...
Previously, has_focus has been set to false upon window click, and
to true upon canvas click.
However, the canvas didn't receive click events when the context
menu was clicked, so fullscreen toggle led to focus loss.
Listening to player click events receives both canvas and context
menu clicks.
2020-11-18 17:50:12 -08:00
relrelb
2e0509694c
docs: Miscellaneous spelling corrections
2020-11-12 13:34:05 -08:00
Mike Welsh
316bc4e920
chore: Appease clippy
2020-11-09 01:52:57 -08:00
Nathan Adams
d7b94316c6
web: Always set the end point of audio clips - fixes #1304
2020-11-03 15:15:34 -08:00
Nathan Adams
32b57f15bc
web: Fixed backspace and delete keys not registering in input fields
2020-11-02 11:43:10 -08:00
Mike Welsh
ef4d75e7d9
web: Fix incorrect handle used in audio ended handler ( fix #1405 )
2020-10-27 19:54:46 -07:00
Mike Welsh
956f40a26f
web: Use a Drop impl to ensure sounds are stopped
2020-10-25 20:41:20 -07:00
Mike Welsh
796805c31b
web: Avoid bug in generational-arena ( fix #1315 )
...
An issue with Arena::clear allowed stale sound instance indices
to be remain valid, causing certain sounds to be removed when they
shouldn't (#1315 ). Workaround this issue by forcing Arena to bump
the generational index.
2020-10-25 20:41:20 -07:00
Mike Welsh
2172fef9bd
web: Only fire mouse events for left clicks
2020-10-23 12:50:59 -07:00
Mike Welsh
827a80c837
web: Remove sound instances upon completion
...
Sounds were not being removed from the instance list when they
completed playing. This could also cause StartSound tags with
NoMultiple set to not play, because the previous sound was presumed
to be playing.
Fixes part of #1245 .
2020-10-12 15:28:31 -07:00
Nathan Adams
627a1f90e1
web: Ignore any errors converting flashvars
2020-10-12 15:28:16 -07:00
Nathan Adams
6d9155477c
core: Add flashvars support - #312
2020-10-12 15:28:16 -07:00
Mike Welsh
4034ef8d79
web: Use PanicInfo::to_string for displaying panic info
...
PanicInfo::payload wasn't giving anything useful (just resulted
in 'Unknown error') -- to_string displays all of the message,
payload, and location of the panic. Particularly the location
is helpful.
2020-10-11 00:51:00 -07:00
Sean-Thomas
a9538f81d0
web: Renamed "prime_audio" and "suspend_audio"
...
Renamed "prime_audio" and "suspend_audio" to "play" and "pause" respectfully.
2020-09-29 11:05:23 -07:00
Sean-Thomas
6b54cc4311
web: Add pause method for web player
...
Adds a suspend_audio method to compliment prime_audio on WebAudioBackend, as well as logic in player.rs on the set_is_playing method to suspend audio when is_playing is set to false. Exposes pause method for the ruffle player in JavaScript with logic to display the play button when paused.
2020-09-29 11:05:23 -07:00
Mike Welsh
313b02d24f
webgl: Fall back to canvas if not using hardware acceleration
...
Display WebGL driver info, detect whether hardware acceleration
is enabled, and fall back to the canvas backend in this case.
2020-09-25 01:22:21 -07:00
Luca Weiss
d5cb396331
*: fix spelling mistakes
2020-09-19 16:17:58 -07:00
Nathan Adams
e114282a4e
web: Implement Show Error Details for panics
2020-09-13 15:20:44 -07:00
Nathan Adams
69d1e903fb
web: Destroy shouldn't be able to throw exceptions
2020-09-13 15:20:44 -07:00
Nathan Adams
58cd1abcf2
web: Store RuffleInstances as a RefCell, so we don't lock it out from readers unless we actually need to
2020-09-13 15:20:44 -07:00
Nathan Adams
1d48073a05
web: Don't mutably lock INSTANCES if we don't need to, to allow greater odds of a successful reentry
2020-09-13 15:20:44 -07:00
Nathan Adams
95275898c7
web: If ruffle panics, inform all instances (if possible) and poison future instances
2020-09-13 15:20:44 -07:00
Nathan Adams
3ff399ca6b
core: Trace only to the log backend, but have the default log backend trace to the log crate
2020-09-13 13:51:39 -07:00
Nathan Adams
4c6c8ee1f2
web: Add trace_observer to web api, which lets you capture trace output from a specific movie
2020-09-13 13:51:39 -07:00
Nathan Adams
de009c7673
core: Add Log backend, for capturing trace output specific to a movie
2020-09-13 13:51:39 -07:00
Mike Welsh
a18e80baf2
chore: Fix clippy lints
2020-09-07 12:18:41 -07:00
Nathan Adams
91cb597a79
web: Expose ExternalInterface callbacks on the player object, not the canvas
2020-09-03 18:17:44 -07:00
Nathan Adams
5880db43cd
web: Respect allowScriptAccess, which defaults to false for streaming or 'sameDomain' for objects
2020-09-03 18:17:44 -07:00
Nathan Adams
b5531a48d0
web: Allow reentrant ExternalInterface callbacks
2020-09-03 18:17:44 -07:00
Nathan Adams
a49e8d8587
web: Implement two-way communication with ExternalInterface
2020-09-03 18:17:44 -07:00
Nathan Adams
43f5506418
web: Implement LocaleBackend for web
2020-09-02 17:12:31 -07:00
Nathan Adams
86eb6f2e50
avm1: Implement Date - #249
2020-09-02 17:12:31 -07:00
Nathan Adams
cb2461920b
core: HTTP request values need to preserve order
2020-08-28 11:53:32 -07:00
Mike Welsh
cab1634624
web: Ensure Key.getCode is set on keyUp
...
Fixes sticking keys in #1046 .
2020-08-26 15:16:46 -07:00
Mike Welsh
eaff74f364
web: Wire up mouse wheel events
2020-08-23 13:38:59 -07:00
Mike Welsh
cbd448522a
chore: Allow unknown clippy lints
...
same_item_push was added on nightly, but is currently throwing
a false negative. I added an allow for it, but this causes a
warning on stable for an unknown lints, so allow unknown lints for
now.
2020-08-12 23:51:12 -07:00
Mike Welsh
6c89869210
chore: Fix clippy lints
2020-08-12 19:04:14 -07:00
David Wendt
c926da8888
Refactor URL relativization into two utility methods that backends can provide base URLs and paths to.
2020-07-23 23:02:54 -04:00
David Wendt
7433bfe28f
Add a `NavigatorBackend` method to resolve relative URLs.
2020-07-23 23:02:53 -04:00
David Wendt
4813942fe7
The player should always change the audio backend's framerate itself.
2020-07-23 23:02:52 -04:00
David Wendt
f56d16a68d
Separate player creation from root movie setup, and allow users of Ruffle to load in movies synchronously or asynchronously.
...
During the small period of time when a player is created but has no root movie, a temporary empty movie is installed with an assumed stage size and framerate of 550x400@12fps. This is Flash default for new projects, so it seemed appropriate. User ActionScript cannot see these values, and I'm not even sure JavaScript can, either.
2020-07-23 23:02:51 -04:00
David Wendt
6998dafdb9
Store an origin URL on every movie that is loaded.
2020-07-23 23:02:50 -04:00
Mike Welsh
8e97fdfe0c
web: Fix WebAudioBackend::stop_sounds_with_handle ( fix #752 )
...
This would incorrectly stop all audio nodes whenever a Stop sound
event was encountered.
2020-06-25 23:04:47 -07:00
CUB3D
166cb60d89
chore: Clean up useage of unwrap
2020-06-24 01:46:07 +01:00
CUB3D
2538d430ff
chore: Format
2020-06-24 01:46:07 +01:00
CUB3D
0644168f12
web: Scope entries in localStorage to the current url ( #379 )
2020-06-24 01:46:07 +01:00
CUB3D
711b202a56
web: Add storage backend based on LocalStorage
2020-06-24 01:46:07 +01:00
CUB3D
4e286b43ae
chore: Format
2020-06-24 01:46:06 +01:00
CUB3D
752ffc5cca
chore: Fix clippy lints and tests
2020-06-24 01:44:07 +01:00
Nathan Adams
59ccd75518
core: Rename loader::LoaderError to loader::Error
2020-06-20 15:02:00 -07:00
Nathan Adams
0f1eef9022
core: Introduce LoaderError to all Loader methods
2020-06-20 15:02:00 -07:00
Nathan Adams
5662b2d4d9
core: Make Value::coerce_to_string return a Cow<str>`
2020-06-19 12:48:28 -07:00
Mike Welsh
33cbc1fe2f
web: Avoid panics on unimplemented audio codecs
2020-06-17 12:14:08 -07:00
Mike Welsh
83feeefeeb
audio: Don't panic on unimplemented codecs
...
Remove `unimplemented` calls when encountring unsupported codecs
such as Nellymoser. Instead, return an Error that can be
gracefully handled.
2020-06-17 12:14:08 -07:00
CUB3D
54701f775e
web: Add dummy set_clipboard impl
2020-06-09 22:41:11 +01:00
Nathan Adams
91b0b28aa8
web: Fixed Key.isDown(13) (enter key) detection on web
2020-06-04 13:41:10 -07:00
Mike Welsh
3a8c705e95
chore: Fix clippy lints
2020-05-30 03:47:12 -07:00
Nathan Adams
b8e63045b2
web: Moved source of core into core/src, to prep for tests
2020-05-19 11:42:54 +02:00
Nathan Adams
b6523324ed
web: Move each web package into a packages/ directory
2020-05-19 11:42:53 +02:00
Mike Welsh
d15a4ed994
web: Fallback to canvas render backend in more cases ( fix #545 )
2020-05-14 22:36:19 -07:00
Nathan Adams
51d9f3ef36
core: Change Player::new to take in a SwfMovie, not &[u8]
2020-05-04 16:07:38 -07:00
Mike Welsh
936b314569
web: Add features for enabling webgl/canvas backend
2020-05-02 10:39:40 -07:00