android - Is it possible to play the YouTubePlayer via STREAM_ALARM -


i have alarm clock app , want users able set youtube video alarm. thing youtubeplayer playing via music stream, means if user going sleep while earphones plugged smartphone, he/she won't able hear alarm. on mediaplayer can set alarm use phone speakers using line of code:

audiomanager.setstreamvolume(audiomanager.stream_alarm, stream_music_volume, audiomanager.flag_remove_sound_and_vibrate); 

is there possibility same youtubeplayer or have play via music stream?

it not possible. can not change youtubeplayer's stream type.
not allowed play youtube videos in background.
being said should not use online resource alarm, network connection might not available. should instead download media file , use mediaplayer (which can handle online resources) , adjust stream type via setaudiostreamtype(audiomanager.stream_alarm). can adjust media player's volume using adjustvolume or audiomanager's setstreamvolume, might have modify_audio_settings permission. note should access_notification_policy permission override not dirturb feature if use youtubeplayer in background media stream.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -