yanwsh / videojs-panorama

a plugin for videojs run a full 360 degree panorama video.
http://yanwsh.github.io/videojs-panorama/
Other
494 stars 159 forks source link

How can i play link vimeo or link have redirect CDN #141

Open dinhtienvu opened 6 years ago

dinhtienvu commented 6 years ago

I have link: https://player.vimeo.com/external/245175297.sd.mp4?s=6ee935ec4a992f00e9124234d0219fed676fcf7b&profile_id=164 This link have CDN redirect for fast videolink.

But when i play on iOS, only have audio not movie? (if not panorama video can play normal) Android, PC, Mac all good, only iPhone stuck :(

Demo link: https://codepen.io/vulieumang/pen/KyYwEo

How can play on iOS normaly?

Thank you

qiyq commented 6 years ago

ios Cross domain! you need use iframe element

nicolasabric commented 6 years ago

I know this issue is pretty old but we had the same issue recently and we managed to work around it with reverse proxies and a bit of URL rewriting.

First step: Replace the player URL with something like that /external/245175297.sd.mp4?s=6ee935ec4a992f00e9124234d0219fed676fcf7b&profile_id=164

Second step: Configure your web server. Here are our Apache and Nginx configuration files in case someone need those.

Apache

<VirtualHost *:80>
    SSLProxyEngine On
    SSLProxyCheckPeerCN on
    SSLProxyCheckPeerExpire on

    RequestHeader set X-Forwarded-Proto https
    AllowEncodedSlashes NoDecode #Mandatory as Akamai use those in their URLs

    ProxyPass /external/ https://player.vimeo.com/external/
    ProxyPassReverse /external/ https://player.vimeo.com/external/

    ProxyPass /akamaized/ https://gcs-vimeo.akamaized.net/ nocanon #Note the nocanon mandatory to avoid URL encoding
    ProxyPassReverse /akamaized/ https://gcs-vimeo.akamaized.net/
</VirtualHost>

Nginx

server {
        listen       80;
        server_name  localhost ;

        location /external {
          proxy_pass      https://player.vimeo.com/external;
          proxy_redirect  https://gcs-vimeo.akamaized.net/ /akamaized/;
        }

        #See https://stackoverflow.com/questions/28684300/nginx-pass-proxy-subdirectory-without-url-decoding/37584637#37584637
        location /akamaized/ {
          rewrite ^ $request_uri;
          rewrite ^/akamaized/(.*) $1 break;
          return 400; #if the second rewrite won't match
          proxy_pass http://127.0.0.1:82/$uri;
        }
}

server {
      listen 82;
      location / {
          proxy_pass https://gcs-vimeo.akamaized.net;
        }
}

Hope this will save some time to someone ;)

vulieumang commented 6 years ago

@nicolasabric Great idea and clear code. But my server work as proxy, I will pay more money for banwitdh?

nicolasabric commented 6 years ago

@vulieumang yes you will. Just out of curiosity I had a look at how Vimeo handle this use case. Turns out they don't :/ They just invite you to download their app, where obviously they can do what they want.