eva-engine / eva.js

Eva.js is a front-end game engine specifically for creating interactive game projects.
https://eva.js.org
MIT License
1.75k stars 108 forks source link

feat: add audio media support #2

Closed lidongjies closed 3 years ago

lidongjies commented 3 years ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

add audio and video media resource support.

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

resource.addResource([
  {
    name: 'bgSound',
    type: RESOURCE_TYPE.AUDIO,
    src: {
      audio: {
        type: 'audio',
        url: 'https://g.alicdn.com/ltao-fe/duck_assets/0.0.1/assets/duckBg.mp3',
      },
    },
    preload: true,
  },
  {
    name: 'successSound',
    src: {
      audio: {
        type: 'audio',
        url:
          'https://g.alicdn.com/ltao-fe/factory/1.1.3/assets/game/sound/success.mp3',
      },
    },
    preload: true,
  },
]);

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No.

Other information: