Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create field option to store media file path #2323

Closed

Conversation

evandrocoan
Copy link
Contributor

Just opened and closed this pull request to save the code somewhere. A better solution was found after writing this pull-request. The new solution would be directly embedding media on the page, the same way images are. For example, I can embed images with <img src='some.png'>, therefore I can also embed other HTML5 media with <audio src='some.mp3'></audio>.

Initially, this pull-request would be a replacement for #540 - Added arguments as [sound:filename|argument1 argument2...]. Instead of creating options for existent [sound:file] tags, it would allow marking a field to store media only.

are used in fields only with the media name. For example,
one can create flashcard fields only with the media name as
AudioEnglish=mysound.mp3 and on the HTML template, use it as
[sound:{{AudioEnglish}}]. This also allows to create JavaScript
play/pause buttons as:
```
<input id="clickMe" type="button" value="Greek"
    onclick="playgreek("{{AudioEnglish}}");" />

<script type="text/javascript">
function playaudio(filename) {
    var audio = new Audio(filename);
    audio.play();
}
</script>
```
1. https://anki.tenderapp.com/discussions/ankidesktop/39466-create-a-special-tag-to-not-auto-play-the-audio

# Conflicts:
#	rslib/src/media/check.rs
@evandrocoan
Copy link
Contributor Author

Closing as this pull-request is not required anymore, as #604 audio elements can already be used with Anki standard tools for handling <img> tags.

@evandrocoan evandrocoan deleted the create_media_only_fields branch January 14, 2023 19:23
@evandrocoan evandrocoan changed the title Create field options to store media file path Create field option to store media file path Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant