
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
blockly-field-player
Advanced tools
A Blockly audio player field.
Audio player capabilities right from the Google Blockly Field.
load()
, unload()
, play()
, pause()
, stop()
npm install --save blockly-field-player
yarn add blockly-field-player
npm run build
or
yarn build
import * as Blockly from 'blockly'
import {FieldPlayer} from 'blockly-field-player'
Blockly.Blocks['test_field'] = {
init: function () {
this.appendDummyInput()
.appendField(new FieldPlayer('http://localhost/test.mp3'), 'FIELDNAME')
}
};
import * as Blockly from 'blockly'
import 'blockly-field-text-box'
Blockly.defineBlocksWithJsonArray([
{
"type": "test_field",
"message0": "%1",
"args0": [
{
"type": "field_player",
"name": "FIELDNAME",
"src": "http://localhost/test.mp3"
}
]
}])
<script src="./dist/index.js"></script>
note: you need to build the package first.
You can provide options object:
Blockly.defineBlocksWithJsonArray([
{
"type": "test_field",
"message0": "%1",
"args0": [
{
"type": "field_player",
"name": "FIELDNAME",
"src": "http://localhost/test.mp3",
"options": {
primaryColor: '#DEA922',
secondaryColor: '#E2D0A7',
backgroundColor: '#FCF3D8'
}
}
]
}])
You can listen for various of player state events, such as:
notloaded
readytoload
unloaded
loading
loaded
playing
paused
error
Just subscribe to state events from the player instance:
Blockly.Blocks['test_field'] = {
init: function () {
const player = new FieldPlayer('http://localhost/test.mp3')
player.on('state', state => console.debug(state))
this.appendDummyInput().appendField(player, 'FIELDNAME')
}
};
By default, even if media source is provided, player will not load it automatically. If you want to change this behaviour and load media to cache during field render, set autoLoad option to true.
const player = new FieldPlayer('http://localhost/test.mp3', { autoLoad: true })
Apache 2.0
FAQs
A Blockly audio player field
The npm package blockly-field-player receives a total of 3 weekly downloads. As such, blockly-field-player popularity was classified as not popular.
We found that blockly-field-player demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.