I am developing a simple game for samsung smart tv. I want to play little sound files when certain things happened like ready, win, lose. I don't want to deal with flash players, player controls .. Is there a way to use javascript to trigger a play sound action with a predefined sound volume and i nwant to do this several times in my code.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
You need to add player object (
SAMSUNG-INFOLINK-PLAYER
) into your<body>
tag:And then in the app's javascript just use this function:
As Player plugin executes in different location inside Samsung's filesystem you need always use absolute path to the file. It can be remote one, but you can use
location.href
of you app'sindex.html
to get absolute local path of app's working directory where you can put the mp3s.Check the documentation, here:
http://www.samsungdforum.com/Guide/View/Developer_Documentation/Samsung_SmartTV_Developer_Documentation_2.5/API_Reference/JavaScript_APIs/Device_API/Player
this was my solution:
add to of index.html file
inside my .js file Scene1.js
I use the SDK version 5.1 for TVs 2013 and 2014 model years and I have the following code works:
And this alternative also works (using Flash):
And many thanks to Dobiatowski!