Opening/playing video or audio using WebViewer or CustomWebViewer

I quickly wrote an app to navigate trough a website where some pages are protected (basic authentication) and some not. To reach the webpage where there are link to files the user has to navigate clicking on webpage links, all these things work perfectly, the problems are:

  1. the error ERR_TOO_MANY_REDIRECTS
  2. clicking on a file (video or audio) both components open it and also I did not find an event fired by clicking on them

About redirect: I did at .htaccess level with a simpe 301 redirect I normally use and it normally works, I checked with browsers and I d not see anything wrong or not working so I do not imagine why I see the error.
I would like to play the multimedia files on one of the 2 components or intercept using an event and redirect to a custom multimedia player.

You should be able to use html5 players in either webviewer, this would be easier with online files....

1 Like

OK, the point is: how can I pass the file url to the player? In my webpages I have some links to the multi media files (that are stored in a specific directory of the web server, not the same of the links). I am trying to find an event fired in this case but seems there is not, also OnDownlodNeeded in CustomWebViewer is not fired.

How would you do this in your computer browser ? By setting the player to the url ?

For example:

<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>Audio</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=0">
</head> 
<body>
<center>
<img src="https://audioboard/media/chillout.png">
<audio controls>
  <source src="https://mydomain.co.uk/music/item1.mp3;" type="audio/mpeg">
</audio>
</center>
</body>
</html>

Then use javascript to generate a playlist or select files from list

Do you also need to download the multimedia files to the device, or to just play them from where they are?

Honestly, using standard PC browser I do not need to do anything, in my reduced browser (written in Python) I intercept the page load event and redirect the file to the media player, so I thougth to do more or less the same thing with this app. In anycase I just need to play the files from where they are, it is the best option in my case. But how can I read the file url if there is no event fired when I click a link inside a webpage? The webpage is displayed inside the WEbViewer associated to the CustomWebViewer, I tryed also to find a way to use the BeforePageLoad of WebViewer but I did not find a way to access the WebViewer object associated with CustomWebViewer, the docs only say that is an object, not so much more.

See here for one method using javascript:

OK, I found the simplest solution... may be useful to know...
customwebviewer-init

setting FileAccess to true solves the main problem and ClearCache solves, at least I interpreted in this way, the proble that it tries to access the file trough the cache. I also ClearCookies but is not related to this problem. It plays audio files inside WebViewer very well without downloaing the file (may be a temporary download I will check better). Now I am testing using video files.
I am also reading/studying the last suggestion you gave me.

1 Like