Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
play = async () => {
if (!this.state.loaded) {
try {
await this.load();
} catch (error) {
console.log(error);
}
}
this.setState({ paused: false });
Sound.setCategory('Playback');
this.sound.play(success => {
if (success) {
console.log('successfully finished playing');
} else {
console.log('playback failed due to audio decoding errors');
}
this.setState({ paused: true });
// this.sound.release();
});
};
// @flow
import Sound from 'react-native-sound'
import { OPEN_AB_ALERT } from '../../src/constants/ActionConstants'
import type { Action } from '../modules/ReduxTypes.js'
import { DISPLAY_TRANSACTION_ALERT } from '../modules/UI/components/TransactionAlert/actions'
const AUDIO_RECEUVED_FILE = 'audio_received.mp3'
const AUDIO_SEND_FILE = 'audio_sent.mp3'
Sound.setCategory('Ambient')
const audioReceived = new Sound(AUDIO_RECEUVED_FILE, Sound.MAIN_BUNDLE, error => {
if (error) console.warn(`failed to load the sound ${AUDIO_RECEUVED_FILE}`, error)
})
const audioSent = new Sound(AUDIO_SEND_FILE, Sound.MAIN_BUNDLE, error => {
if (error) console.error(`failed to load the sound ${AUDIO_SEND_FILE}`, error)
})
const playCb = audioName => success => {
if (success) {
console.info(`successfully finished playing ${audioName}`)
} else {
console.warn(`playback ${audioName} failed due to audio decoding errors `)
}
}
// TailOrder
import {
voidLine,
sendOrder,
printOrder,
cancelOrder,
tailOrderLine,
changeOrderTable,
getOrder,
orderItemToReceiptItem,
} from "../../services/tailorder";
import { currentLanguage } from "../../translations/CurrentLanguage";
const Sound = require("react-native-sound");
Sound.setCategory("Playback");
const beep = new Sound("beep.mp3", Sound.MAIN_BUNDLE);
import translation from "../.././translations/translation";
import LocalizedStrings from "react-native-localization";
let strings = new LocalizedStrings(translation);
@inject(
"itemStore",
"customerStore",
"receiptStore",
"discountStore",
"categoryStore",
"paymentStore",
"printerStore",
"shiftStore",
"attendantStore",
"stateStore",
)
/* @flow strict-local */
import Sound from 'react-native-sound';
import * as logging from './logging';
if (Sound && Sound.setCategory) {
Sound.setCategory('Ambient', true);
}
const messageSound = new Sound('zulip.mp3', Sound.MAIN_BUNDLE, (error: Error) => {
if (error) {
logging.error(error);
}
});
export const playMessageSound = () => messageSound.play();
constructor(props) {
super(props);
Sound.setCategory('Playback', true); // true = mixWithOthers
// Special case for stopping
this.stopSoundLooped = () => {
if (!this.state.loopingSound) {
return;
}
this.state.loopingSound.stop().release();
this.setState({loopingSound: null, tests: {...this.state.tests, ['mp3 in bundle (looped)']: 'win'}});
};
this.state = {
loopingSound: undefined,
tests: {},
};
}
import React, { Component } from 'react';
import {
StyleSheet,
View,
TextInput
} from 'react-native';
import { ButtonGroup, Button } from 'react-native-elements'
import { API, graphqlOperation } from 'aws-amplify'
var Sound = require('react-native-sound')
Sound.setCategory('Playback')
import codes from './codes'
import query from './query'
const buttons = [
'French',
'Portugese',
'Spanish',
'German'
]
export default class App extends Component {
state = {
index: 0,
codes,
sentence: '',