garyconstable
garyconstable

Reputation: 309

Youtube video without iframe, three.js, A-frame

Is it possible to play youtube videos without the IFRAME and player?

I would like to be able to play the video on a video texture.

You see show I have done it here:

http://dev3.garyconstable.co.uk/

This is the code that will play my own mp4

<a-scene>
  <a-assets>
    <video id="video" autobuffer height="240" width="360" autoplay loop="true" crossorigin="anonymous" webkit-playsinline>
      <source src="media/videos_s_7.mp4">
    </video>
  </a-assets>
  <a-videosphere id="vid-sphere"  autopla="true"></a-videosphere>
</a-scene>

I would like to be able to play a video that comes from youtube.

JW player seem to be able to play youtube video's

https://support.jwplayer.com/customer/portal/articles/1406725-youtube-video-embed

is it possible and what are my options? Do youtube offer any kind of paid for service for additional features?

Upvotes: 2

Views: 1215

Answers (1)

Nikola Lukic
Nikola Lukic

Reputation: 4244

Better forget any player for this job.

Note :

JW Player uses the official iFrame player API from YouTube to play a video inside of JW Player. 

Reasons:

  • youtube.com will not accept cross domain on there servers.

You will need to add server part for you web app. I use nodejs.

This is procedure:


  ----> Use classic google , youtube APi login/search
  ----> Make search and collect search result data (Most important is `videoId` )
  ----> Save to your own server 
  ----> Call from web app your new route.

Now you can do what ever you want.

Direct demo link: https://maximumroulette.com:3000

Full solution at: https://github.com/zlatnaspirala/vue-typescript-starter

Upvotes: 0

Related Questions