Skip to main content
Version: Next


API Reference: Device.Sound

Sound is used to control the playback of sound files.

Permisions for Android

loadURL method INTERNET permission to use network-based content. Add it to manifest file in your project for publishing.

loadFile method requires READ_EXTERNAL_STORAGE permission on API Level 32 and below and READ_MEDIA_AUDIO on API Level 33 and above.

import PageSampleDesign from "generated/pages/pageSample";
import { Route, Router } from "@smartface/router";
import Application from "@smartface/native/application";
import Button from "@smartface/native/ui/button";
import Sound from "@smartface/native/device/sound";

//You should create new Page from UI-Editor and extend with it.
export default class Sample extends PageSampleDesign {
mySound: Sound;
myButton: Button;
constructor(private router?: Router, private route?: Route) {

// The page design has been made from the code for better
// showcase purposes. As a best practice, remove this and
// use WYSIWYG editor to style your pages.
centerizeTheChildrenLayout() {
type: "updateUserStyle",
userStyle: {
flexProps: {
flexDirection: 'COLUMN',
justifyContent: 'CENTER',
alignItems: 'CENTER'

onShow() {
const { headerBar } = this;
Application.statusBar.visible = false;
headerBar.visible = false;


onLoad() {

this.mySound = new Sound();
this.mySound.isLooping = true;

this.myButton = new Button({
text: "Load URL",
onPress: () => {
this.mySound.onReady = () => {;

this.addChild(this.myButton, "myButton", ".sf-button", {
top: 100,
width: 100,
height: 80,
backgroundColor: "#FFFF00",