0

The title is not explaining anything but here is what I have to ask.

I'm working on someone's Blogger site who is displaying a whole webpage from another site of a different domain. We don't need the whole page to show up but a specific content which is a player streaming live from that reference site. I'm trying to hide everything except for that streaming element but could not do it. I've tried to make it work using js and jQuery but couldn't do it. While surfing around I found this but couldn't make it work either.

$('div:not(#player)').hide(); $('#player').appendTo('body');

player is the id of the div of the player I'm trying to display. Is it because of the Cross-origin Resource Sharing that I can't do anything using js or jQuery ? Talking about which I don't want to modify anything of the second webpage, just to hide every other element without the player. How can I do it ?

In here anyone can see the page I'm trying to work on: http://goo.gl/Y6AwII

P.S. First question in this community, thanks in advanced for any help :)

Edit: Since site1.com is streaming who has proper rights, so anyone who tries to embed the player on his/her own site should know that it won't work. Because the streaming server will not stream to any other domain except for the authorized one. And so I'm closing the question but any discussion on topic is welcomed. Thank you everyone for your comments and answers as indeed they helped.

Community
  • 1
  • 1
  • 1
    May you should have a look for the source of the streamed content and use the player with that source. But keep copy right law in mind. – harmoniemand Mar 01 '16 at 12:15
  • This is very simple, just make a player only version at that other domain and load that separately ... if it is not your site, then you likely shouldn't do this at all – Asons Mar 01 '16 at 12:20
  • @harmoniemand : that is a good idea. Thanks and let me try :) – the tombStone Mar 01 '16 at 12:22
  • @LGSon : The reference site(from where the second page is coming) is not mine. Thanks though :) – the tombStone Mar 01 '16 at 12:26
  • @harmoniemand : Could you please be a bit more specific about "using the player with that source" part ? Thank you again! – the tombStone Mar 01 '16 at 13:04
  • if you have a look in the website of your iframe, there is a part where the player is embeded. if you embed this player to your website it may works. – harmoniemand Mar 01 '16 at 13:47
  • @harmoniemand : Ah yes! But connection is rejected because of token issue. Seems like they are using a third party for streaming. I'm still trying with this. May be I will be able to pull something off. That helped, thank you for being patient :) – the tombStone Mar 01 '16 at 14:10

1 Answers1

0

I see two ways to make it work in a nice way.

1) Assuming that you are using a PHP server, the most difficult but best way would be to crawl the the site that you get the the player from, and then use DOMDocument Api (which you can read more about here: http://php.net/manual/en/class.domdocument.php) where you can fetch the html that contains the player, (searching for #player id) and then replicate the player on the blog. That way you can implement the player in a way that fits the best into the blog.

2) Using a iframe can also be used, but then you have the hassle with hiding stuff.. Not so fun. :)

miqueloi
  • 688
  • 4
  • 13