7

I am working on a website in which proper url doesn't show up after copying from the embed button.

On clicking embed button(as shown below in an image), I am getting the following code inside iframe in which the value of src is not correct. It should be a proper video url.

<iframe src="//content.jwplatform.com/players/dalet_clips/35472P.mp4-88sIiZig.html" width="640" height="360" frameborder="0" scrolling="auto"></iframe>

enter image description here


The snippets of code which I am using inside jwplatform.js is:

"sharing": {
    "code": "%3Ciframe%20src%3D%22http%3A//content.jwplatform.com/players/MEDIAID-6gKQPrHW.html%22%20width%3D%22480%22%20height%3D%22270%22%20frameborder%3D%220%22%20scrolling%3D%22auto%22%3E%3C/iframe%3E",
    "link": "http://content.jwplatform.com/previews/MEDIAID-6gKQPrHW"
},

Problem Statement:

Inside iframe src, I am getting the following code //content.jwplatform.com/players/dalet_clips/35472P.mp4-88sIiZig.html which is not correct. It should be proper url of the video. I am wondering what changes I need to do so that I get the complete video url inside iframe src.

flash
  • 1,455
  • 11
  • 61
  • 132
  • What is the proper video URL? – Rakib Feb 12 '19 at 16:53
  • The proper video url starts with `http://www` Sorry, I can't share the complete url. – flash Feb 12 '19 at 17:15
  • Well, I have made an example for you, please see here-https://jsfiddle.net/rakibh/acw2qxdf/ – Rakib Feb 12 '19 at 17:36
  • 1
    Which version of JW player you are using - 7 or 8? What is your full JS code and where did you place it - in the document `head` or `body`? Do you use any relevant WordPress plugins? – Sally CJ Feb 12 '19 at 23:33
  • The version of JWplayer which we are using is 8.7.5. I am not using any wordpress plugins. I am using Javascript code. – flash Feb 13 '19 at 02:31
  • @SallyCJ Do you have any idea how the `box picture` which I have pasted in the question above is getting created ? I looked into my JS code and I am not able to find anything. – flash Feb 13 '19 at 16:24
  • @flash Check [this](https://codepen.io/anon/pen/RvYGaB/left/?editors=1010#0) - I used JW player version 8.7.5 and a (dummy) video that's hosted on jwplatform.com. – Sally CJ Feb 14 '19 at 05:30

2 Answers2

4

Try changing the code property in the sharing option in jwplatform.js to encodeURIComponent of whatever you want to be the exact iframe content

Example: now you have the code as %3Ciframe%20src%3D%22http%3A//content.jwplatform.com/players/MEDIAID-6gKQPrHW.html%22%20width%3D%22480%22%20height%3D%22270%22%20frameborder%3D%220%22%20scrolling%3D%22auto%22%3E%3C/iframe%3E

Now try to decode this with decodeURIComponent(code) which evaluates to :

<iframe src="http://content.jwplatform.com/players/MEDIAID-6gKQPrHW.html" width="480" height="270" frameborder="0" scrolling="auto"></iframe>

You should try changing both code and link to your actual video link and code. just encode whatever content you want to be as code with encodeURIComponent or test the current one with decodeURIComponent, also keep the correct link in the link property.

Towkir
  • 3,889
  • 2
  • 22
  • 41
3

Probably you are making a mistake when you say that:

  • //example.com it is not a valid url... - Nope. It's absolutely valid url. Even, it's better type of url (called schemeless url, without http: prefixing).

  • ...there should be video url (mp4) inside SRC... - No again. iframes are for web-pages (including .html pages), or not files (like .mp4 or other file extensions), so that is the correct form of url.

I think your problem is something different:. Maybe that video file is deleted from server? Or something doesn't actually work on that destionation url? Check problems there.

p.s. you should have posted an example url which works (just change domain to example.com if you dont want to share it).

T.Todua
  • 53,146
  • 19
  • 236
  • 237