Load a sound for a given resource id

Property definitions

android $ MediaPlayer :: load_sound
	# Load a sound for a given resource id
	fun load_sound(id: Int, context: NativeActivity): Music do
		# FIXME: maybe find a better way to handle this situation
		# If two different music are loaded with the same `MediaPlayer`,
		# a new `NativeMediaPlayer` will be created for the secondd music
		# and the nit program will loose the handle to the previous one
		# If the previous music is playing, we need to stop it
		if playing then
			stop
			reset
			destroy
		end

		self.nmedia_player = new NativeMediaPlayer.create(context, id)
		if self.nmedia_player.is_java_null then
			self.error = new Error("Failed to load a sound")
			self.sound = new Music.priv_init(id, self, new Error("Sound loading failed"))
			return self.sound.as(not null)
		else
			if self.error != null then self.error = null
			self.sound = new Music.priv_init(id, self, null)
			self.is_prepared = true
			return self.sound.as(not null)
		end
	end
lib/android/audio.nit:393,2--417,4