0

I am building an Android & iOS App that has a video player, I am using one video hosting site(Wistia) for my videos. All videos are domain restricted, which means those will be played on a listed domain. The videos are getting properly played inside the web app(As we have allowed the video to be played for that domain) but I am not able to play those in my Android/iOS app.

Note: When I remove domain restriction from the video, then I am able to play the video in my app.

Can someone help me to find the domain of my Android app? Where should I define it in the code?

Below is the Wistia embedded code:

<script src="https://fast.wistia.com/embed/medias/j4q2kxdfd4.jsonp" async></script><script src="https://fast.wistia.com/assets/external/E-v1.js" async></script><span class="wistia_embed wistia_async_j4q2kxdfd4 popover=true popoverAnimateThumbnail=true" style="display:inline-block;height:84px;position:relative;width:150px">&nbsp;</span>

Thank you.

Kavita Patil
  • 1,784
  • 1
  • 17
  • 30
  • What is the domain, & how do you know it is restricted, is it on `http://`? – Darshan Mar 01 '21 at 08:34
  • @DarShan I am using wistia video hosting site. There you can specify the domain for which you want to play the video, let's say my domain is abc.com, I have added that in the list. That's why the video is getting played only on abc.com but not in other domains. Now I want to play these videos in Android/iOS app. But because of the domain restriction those are not working. – Kavita Patil Mar 01 '21 at 09:13

1 Answers1

1

Wistia is targeted at websites - they did have an iOS mobile app in the past but this was aimed more at contact owners, I believe, and is not supported anymore, either way.

They highlight this in their documentation (at time of writing):

Mobile OS Support

Most mobile devices only support HTML5 playback, which is Wistia’s default for mobile. This includes Android phones and tablets (4.1 and up), and iOS devices like iPhones and iPads.

To include Wistia in an app, the most recent way I have seen recommended by Wistia is to use a WebView and the standard embed code. This will allow you use the usual domain restrictions you have set.

The domain checking feature is most likely using the 'origin' or the 'referrer' field in the HTTPS request to determine the site the embed code is being used in. It is possible it is using a more complex mechanism than this but I think you will have to contact Wistia directly if and ask for support of that is the case.

Assuming it is this mechanism, you can look at the request headers in a browser inspector. For example, taking a site that uses Wistia and looks at the requests you will see something like this:enter image description here

I've hidden the exact site name but both the origin and the referrer are the same top level domain name for the site hosting the videos.

The website on a mobile app will work the same way but if you are using a WebView in an Android app you will need to set the fields yourself, You may need to experiment as there seems to be different approaches but this is a good starting point: https://stackoverflow.com/a/5342527/334402

If you set these headers to a domain that is included in your set of allowed domains and the video still will not play then I think you will need to contact Wistia support directly.

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Hi @Mick, I have tried in a similar way. I hosted a site with a domain name present in the Wistia allowed domain list & embedded the video in that. In the mobile app, I used a WebView and tried to load the page. Still, it's not working. – Kavita Patil Mar 01 '21 at 12:01
  • Can you share the logcat logs you are seeing for this case? Also, are you setting the referrer header - see example here: https://stackoverflow.com/a/5342527/334402 – Mick Mar 01 '21 at 13:18
  • When I try with the – Kavita Patil Mar 01 '21 at 15:14
  • Could you share you embed code in the question - you can obfuscate the urls etc if necessary? – Mick Mar 01 '21 at 15:40
  • Yes, I have added the Wistia embed code, please check – Kavita Patil Mar 01 '21 at 16:14