How to use the react-native-track-player.skip function in react-native-track-player

To help you get started, we’ve selected a few react-native-track-player examples, based on popular ways it is used in public projects.

github moonou / siren / src / store / models / music.js View on Github external
}
      if (!playerQueenTrack) {
        
        if (!track.artwork) {
          track.artwork = 'http://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg'
        }
        
        console.log('add Track', track)
        await TrackPlayer.add(track)
      }

      if (addHistory) {
        this.history.push(this.trackId)
      }
      this.trackId = trackId
      await TrackPlayer.skip(trackId)
    }
    await TrackPlayer.play()
  }
  @action
github moonou / siren / src / lib / sound.js View on Github external
async play (trackId) {
    if (trackId) {
      await TrackPlayer.skip(trackId)
    }
    return TrackPlayer.play()
  }
  static get instance () {
github m-inan / react-native-music-app / src / reducers / Player / actions.js View on Github external
return async (dispatch, getState) => {
		const { shuffle } = getState().Player

		if (!shuffle && position > 0) {
			const queue = await TrackPlayer.getQueue()

			dispatch(setUserPlaying(false))

			TrackPlayer.skip(queue[0].id)
		} else {
			dispatch(playbackTrack())
		}
	}
}
github AbelTesfaye / dingo / src / BL / Services / event-handler-service.js View on Github external
TrackPlayer.add(mutableTracks).then(() => {
				TrackPlayer.skip(track.id).then(() => {
					callback();
					globals.shouldUIRespondToEvents = true;
				});
			});
		} else {
github m-inan / react-native-music-app / src / reducers / Player / actions.js View on Github external
const { replay, shuffle, track } = getState().Player

			if (position && duration && position >= duration) {
				if (replay) {
					await TrackPlayer.seekTo(0)
				} else if (shuffle) {
					let queue = await TrackPlayer.getQueue()
					queue = queue.filter(item => item.id !== track.id)

					const count = queue.length - 1
					const index = Math.floor(Math.random() * count)

					const trackId = queue[index].id

					await TrackPlayer.skip(trackId)
				}
			}
		}, 500)
github m-inan / react-native-music-app / src / reducers / Player / actions.js View on Github external
.find(item => item.id === playlistId)
				.list.filter(item => item.exists)
				.map(({ title, artwork, videoId, source }) => ({
					title,
					artwork,
					id: videoId,
					url: source,
					artist: 'Minan'
				}))

			await TrackPlayer.add(addList)

			dispatch(setPlaylist(playlistId))
		}

		await TrackPlayer.skip(videoId)

		await new Promise(resolve => setTimeout(resolve, 100))

		dispatch(setUserPlaying(true))
	}
}