Commit Graph

237 Commits

Author SHA1 Message Date
Mike Welsh 16bd7fade6 web: Use case-insensitive check for detecting javascript scheme 2021-02-08 03:41:16 -08:00
relrelb 074731e1a4 audio: Add Nellymoser support 2021-02-02 00:41:01 -08:00
Mike Welsh 07ab770d4c web: Fix panning of mono sounds (fix #3017) 2021-02-01 13:18:24 -08:00
Mads Marquart 1990e51639 avm2: Add UiBackend::display_unsupported_message
To allow displaying rich content when unsupported ActionScript 3 content is encountered.
2021-01-31 23:04:20 -08:00
Brian Gontowski 31dd2729e2 web: Add an onFSCommand callback into JavaScript 2021-01-31 18:03:31 -08:00
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