cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Playing Audio file from Sharepoint site

Hi 

I have a canvas application that read lists from my sharepoint site https://mycompany.sharepoint.com/sites/Communication, it is working fine.

I have a flow that save speech files in this Sharepoint site under a folder "audiofiles"

Now I want to use powerapps media to play the audio file from the url https://mycompany.sharepoint.com/sites/Communication/audiofiles/fileName.wav

The audio media doesn't play the file in mobile but it play it well when I open the canvas app in the computer browser.

The app media can play public audio nicely in mobile & PC such as https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 but will not play the same file if I saved it in the sharepoint site under /audiofile/.

 

I also added the sharepoint folder which host the audio file in my app and I can display it's content (audio files) in a browser gallery.

I also tried using html5 inisde HTML Text control using <audio src"" controls></audio> again same problem, not working in mobile powerapps.

 

How come I can call the lists from the site but I can't play the audio file.

 

Is it something related to CORS in Sharepoint, if yes, how to solve it?

If I can call the document library folder in my app, can I call the audio files from it and pass it to media player?

 

My Goal: I am looking for a way to let media player to play my audio files hosted in the Sharepoint site.

 

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

After long hours trying many workarounds, I was able to find an easy way to play the audio files directly from SharePoint. It was inspired by BrwoserGallery1.selected.Attachments in the post link shared by @WarrenBelz. This saved me adding more components like the gallery.

I put a text label to display the attachment value result coming from the

 

First(BrwoserGallery1.selected.Attachments).Value

 

 I got a link in this format 

 

appres://datasources/myList/table/7e5xxx-xxxx-xxx-xxxx-xxxx/rows/2/reference/https:%2F%2Fxxx-00x.azure-apim.net%2Fapim%2Fsharepointonline%2F3c....Attachments%2525252f2%2525252f{myfilename}.wav%2F$value

 

 

When I passed this link as media the audio player plays my audio file from SharePoint without any problems. Now I deleted the BrowseGallery and the text label from my canvas app and start passing the filename through the list columns.

 

This might not be a proper solution but considering the current stage of PowerApps components its enough for me.

 

Hope this helps someone in the future.

 

Thanks goes to @WarrenBelz 

 

Regards,

 

Ashraf Awwad

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

Hi @aawwad ,

This is a solution is that you will stop trying - see this post.

It is exactly the same reason that photos in a SharePoint Library will not display on a mobile device (although there is a workaround for these with Thumbnails).

I have tried with OneDrive, Google Drive and Dropbox also without success, although on this post, it was suggested Dropbox might work, it worked form me on the PC by not mobile.

Bear in mind however if you want to add these to the Media in PowerApps (size limits apply), they will work.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted

After long hours trying many workarounds, I was able to find an easy way to play the audio files directly from SharePoint. It was inspired by BrwoserGallery1.selected.Attachments in the post link shared by @WarrenBelz. This saved me adding more components like the gallery.

I put a text label to display the attachment value result coming from the

 

First(BrwoserGallery1.selected.Attachments).Value

 

 I got a link in this format 

 

appres://datasources/myList/table/7e5xxx-xxxx-xxx-xxxx-xxxx/rows/2/reference/https:%2F%2Fxxx-00x.azure-apim.net%2Fapim%2Fsharepointonline%2F3c....Attachments%2525252f2%2525252f{myfilename}.wav%2F$value

 

 

When I passed this link as media the audio player plays my audio file from SharePoint without any problems. Now I deleted the BrowseGallery and the text label from my canvas app and start passing the filename through the list columns.

 

This might not be a proper solution but considering the current stage of PowerApps components its enough for me.

 

Hope this helps someone in the future.

 

Thanks goes to @WarrenBelz 

 

Regards,

 

Ashraf Awwad

View solution in original post

Highlighted

Thats great @aawwad ,

Rather ironic I did not take my own advice . . .

I was focusing on your requirement to play from a Library. It is however interesting that the same workaround for photos to show images that work on both PC and mobile devices also plays audio - this actually makes a lot of sense, but like most "left field" solutions, they are not obvious.

Highlighted

Hi @aawwad ,

I don't think you realize what you may have discovered here - I cannot find anything on it in a Google search.

You can turn Power Apps into a Media Player with a Gallery of tunes and even filter them by genre, artist, album etc, but better than that, instructional audio files and even audio help on errors can be done.

All that is needed is to attached one media file to each list item and then set the Media (as you have discovered) to 

First(GalleryName.Selected.Attachments).Value

then select the item and press Play on the media player. The two things I have not been able to work out is how to autoplay more than the first item and how to get the value with a Lookup.

 

Highlighted

Hi @WarrenBelz 

 

With this URL I was able to call any media file directly from the document library, now I can play the audio if I know the filename so I am passing it along with the Title in one list.

By querying the list using the ID, I can get the filename and pass it to the media player as media property

 

 

"appres://datasources/myList/table/7e5xxx-xxxx-xxx-xxxx-xxxx/rows/2/reference/https:%2F%2Fxxx-00x.azure-apim.net%2Fapim%2Fsharepointonline%2F3c....Attachments%2525252f2%2525252f" & LookUp(selectedAudio , ID=<query ID>).filename & "%2F$value"

 

 

In my case am passing the audio selection between screens using created lists from the original list:

AudioList (initial loading from SharePoint) -> colAudio (PowerApps on Start) -> selectedAudio (when one item related to audio selected)

this way I am using only First 

 

 

"appres://datasources/myList/table/7e5xxx-xxxx-xxx-xxxx-xxxx/rows/" & First(selectedAudio).ID & "/reference/https:%2F%2Fxxx-00x.azure-apim.net%2Fapim%2Fsharepointonline%2F3c....Attachments%2525252f2%2525252f" & First(selectedAudio).filename & "%2F$value"

 

 

 

Regards,

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,406)