UWP WebView: Playing audio when the window is minimized without a source - javascript

So currently I am developing an application that I'd of hoped to work on Windows, Xbox, etc.
I am trying to developer a wrapper for a javascript library that plays music. This library does not exist in any other form, and only provides the music as encrypted files. It handles playing the audio, pausing, fetching, etc. To change anything you call js methods.
So I am currently using a hidden UWP webview, with custom js/html to play and pause the audio coming from the js library. I was fiddling around with it and noticed if I minimized it, the audio is stopped from the webview. I cannot set a media source for a backgroundtask as I cannot get the actual source of the audio. That is all handled by the js library.
I am hoping to find a way to use UWP, along with this webview "hack". Am I trying to accomplish the impossible?

Related

Get live audio and video preview in reactjs

I am trying to develop a feature like google-meet wherein it let's you test the audio and video by previewing it through audio bar fluctuating as well as input video and testing speaker along with letting you select the appropriate input channels in a react application without using any external sdk or package or library.
Can somebody help me out in the same?
I tried looking up in github and web but no solution so far.

Is there a way to open an HTML5 video in the Native Android Video Player?

I am using Cordova to create an APK.
The Android WebView does not allow scrubbing of HTML5 video.
Is possible to open my app's video in Android's Native Video Player.
The HTML is simple:
<video src="video.mp4"></video>
For the scrubbing issue, I have tried to render the video as an iframe and embedded element but neither have worked.
I have also tried to invoke JS commands on the video. While these work in my browser, they do not work when exported to an APK.
I have also researched related SO posts but found no solidifying answers.
How would you make a call to another app on the device?
I read about using Intent but that appears to be a Native solution, such as developing the app in Android Studio.
you will have to use cordova-plugin-media.
read this documentation https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-media/index.html
additionally you can also use any freely available jquery media player plugins
for eg. https://videojs.com/

How to play System Media Sounds

I'm developing an Desktop application using ElectronJS.
How can I play System Media sounds?
I know that for C# I can use
// Plays the sound associated with the Asterisk system event.
System.Media.SystemSounds.Asterisk.Play();
How can I do a similar call on ElectronJS?
As far as I am aware, there is no way to play a system sound using an Electron app directly. However, there are workarounds. You can ship with system sounds in your application and playing one depending on the OS your user is running, and shell beeps can be provided by importing shell from Electron and calling shell.beep();.
Another alternative may be detecting what OS is being used and pointing your media player at the relevant system sound file. This can be done with a hidden window that includes an HTML5 media player.

React-Native and playing music from the Soundcloud API?

I am just getting started with React-Native. Does anyone have any experience getting soundcloud songs to play? I have tried an iframe webview, but I need the song to be playing while surfing through the app. The webview only allows for me to play something while the webview is open.
I am thinking the best way to do this would be to have an invisible iframe webview that never gets refreshed. Is this possible?
I've also tried using the react-native-sound package, however I can't use that to stream from the soundcloud Stream URL.
Does anyone have any ideas/worked with this before?
I would recommend a more native implementation.
There is an Objetive C/Cocoa (iOS) wrapper available that supports the audio streaming. https://github.com/soundcloud/cocoa-api-wrapper
There is also an Android one (it looks like support was discontinued, but still should work) https://github.com/soundcloud/java-api-wrapper
You can wrap those using Native Modules and let the OS handle the playing of the audio. It will work better than some WebView based circumvention.
I have a suggestion.
Use this library for soundcloud api in react-native.
https://github.com/nhayflick/ReactNativeMusic

Android javascript api silent mode

I am writing an app that works a bit like 'do not disturb' but with a timer.
So I want to set the phone onto 'silent mode' for a while and then switch it back to the original volume.
I also want to keep the app running (i.e. keep screen on) for the duration of the timer.
But I want to do all this from an HTML5 / Javascript app.
Is this possible with the javascript api? Or any html5/js toolkit?
It should be possible to do with Javascript in a WebView. With WebView.addJavascriptInterface() you can insert a object from your Android code which you can call to from your Javascript code that is running in the WebView.

Categories