# Play background music via LS2 API

**URL:** <https://forum.webosose.org/t/play-background-music-via-ls2-api/560>\
**Category:** App Development\
**Created:** [September 30, 2018, 12:49pm UTC](https://forum.webosose.org/t/play-background-music-via-ls2-api/560 "2018-09-30T12:49:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ji12345](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/ji12345/32/175_2.png) [@Ji12345](https://forum.webosose.org/u/Ji12345)\
**Post date:** [September 30, 2018, 12:49pm UTC](https://forum.webosose.org/t/play-background-music-via-ls2-api/560/1 "2018-09-30T12:49:11Z")

</div>

Hi,  
I am trying to make basic app with background music(mp3 file).  
But it is not working. My team members are facing huge difficulties because there is no example for how to use the luna service in javascript in WebOS ose develop page.

Below is my source code.

```
<script src="webOSjs-0.1.0/webOS.js" charset="utf-8"></script>
<script type="text/javascript">
   var lunaReq= webOS.service.request("luna://com.webos.media",
    {
        method:"load",
        parameters:{
			uri: 'music.mp3',
			type : 'media'
		},
        onSuccess: function (returnValue, mediaId) {
			playalarm(mediaId);
        },
        onFailure: function (args) {
        }
    });

	var playalarm = function(mediaId) {
		webOS.service.request("luna://com.webos.media", {
			method:"play",
        	parameters:{
				media : mediaId
			},
			onSuccess: function (returnValue, mediaId) {
				console.log(mediaId);
			},
			onFailure: function (args) {
			}
		})};

</script>

```

Many thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![yisooan](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/yisooan/32/156_2.png) [@yisooan](https://forum.webosose.org/u/yisooan)\
**Post date:** [October 1, 2018, 2:43am UTC](https://forum.webosose.org/t/play-background-music-via-ls2-api/560/2 "2018-10-01T02:43:57Z")

</div>

It might be that you looking for

See [http://webostv.developer.lge.com/develop/js-services/calling-js-service/](http://webostv.developer.lge.com/develop/js-services/calling-js-service/)

---

<div class="post-metadata">

**Author:** ![Ji12345](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/ji12345/32/175_2.png) [@Ji12345](https://forum.webosose.org/u/Ji12345)\
**Post date:** [October 1, 2018, 3:16am UTC](https://forum.webosose.org/t/play-background-music-via-ls2-api/560/3 "2018-10-01T03:16:06Z")

</div>

Thanks,

But I think your link is for WebOS TV. Is it all same with WebOS OSE?

---

<div class="post-metadata">

**Author:** ![n-jay](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/n-jay/32/126_2.png) [@n-jay](https://forum.webosose.org/u/n-jay)\
**Post date:** [October 1, 2018, 4:18am UTC](https://forum.webosose.org/t/play-background-music-via-ls2-api/560/4 "2018-10-01T04:18:34Z")

</div>

@Ji12345 Its the same, no difference at all.  
Also in case you've missed it, the exact same documentation exists in the OSE site as well.  
[http://webosose.org/develop/js-services/calling-js-service/](http://webosose.org/develop/js-services/calling-js-service/)
