Why can't I display an embedded video from a YouTube Live stream? - api

I found a script that lets me use the Youtube API to access a channel, recognise if there is any live stream and give me the id of this specific video that is being broadcasted.
However, when it is embedded on my page as:
<iframe width="500" height="600" src="//www.youtube.com/embed/{$this->live_video_id}{$autoplay}" frameborder="0" allowfullscreen>
I cannot play it. The video shows up, and when I press "play" it gives me a "Playback error".
I removed the $autoplay part because this was giving me problems and it worked! And then it didn't work. It's so frustrating. I copy-pasted the url only in my address bar
www.youtube.com/embed/[Whatever the id is here]
and it worked! And then it didn't work. I just cannot understand why it works sometimes and sometimes not.
Everytime I do something it works for 5 seconds and then it breaks and it doesn't want to show it. When I closed the live stream to try with another one. It showed the old (already archived) live stream. Nonsense!
I read somewhere that you need to embed the video from the live stream, but then the whole idea to use an API is futile. Also I tried enabling AdSense because this could also help, but it didn't.
What can I do to get an embedded YouTube live stream video on my website?

Update:
Since I couldn't figure it out and YouTube tightened their API quota points a lot as of February 2019. I just switched to Twitch API and everything worked from the first try.

You haven't closed the iframe tag
Correction in code
<iframe width="500" height="600" src="//www.youtube.com/embed/{$this->live_video_id
{$autoplay}" frameborder="0" allowfullscreen></iframe>
Source

Related

play instagram video fetched from public api

I've searched a bit here on SO to find a way to show instagram video using the public api ?__a=1 method. I've found a question that have pointed me into the right direction but not at all.
after I get the user media, I'm checking in my vue app if the resource is a video or an image and if is a video I show an html5 player where I'm binding the url that is obtained form the public json api. What I'm facing is that the player will not reproduce the video, but if I use the url into the browser, an html5 player is loaded with the related video that will start playing.
The video urls returned are something like this one:
"https://scontent-mxp1-1.cdninstagram.com/v/t50.2886-16/117420353_635186773777278_7723572524374891239_n.mp4?_nc_ht=scontent-mxp1-1.cdninstagram.com&_nc_cat=106&_nc_ohc=nI6tYDeag-0AX8MtmoL&oe=5F3C077B&oh=a47046b1aabf223f16c4c66526e20e57"
I've tried to remove all the part after the .mp4 file extension but this will not work, so I suspect that all the url is needed. Is there a way that I can use to reproduce video in my app?
After many tryes unfortunately I didn't figured out how to use my own HTML5 player so I've used a simple solution. An <iframe> with the url set will let the vido play into the app, this exclude me from the ability to remove the download button or controls from the player but at the moment it's the only way I can implement to achieve my scope.
(1) Your link works okay for me in a video tag:
<video width="640" height="480" >
<source src="https://scontent-mxp1-1.cdninstagram.com/v/t50.2886-16/117420353_635186773777278_7723572524374891239_n.mp4?_nc_ht=scontent-mxp1-1.cdninstagram.com&_nc_cat=106&_nc_ohc=nI6tYDeag-0AX8MtmoL&oe=5F3C077B&oh=a47046b1aabf223f16c4c66526e20e57"
type="video/mp4">
</video>
(2) It even works okay in this random demo that uses vue.js.
With no demo page of your problem the solution is a guess...
Make sure that your own site URL starts https:// or else change the video src to http://...etc.
Make sure your server (settings?) isn't somehow blocking you from loading the file.
If still failing, show us the problem via some link to your testing page.

Safari plays audio only once when using <amp-audio>

I'm trying to have a short sound that I can play over multiple times by simply the play button on AMP. On Safari (desktop and mobile) the sound will only play once.
The sound is supposed to be triggered when the user clicks a button.
I've followed the amp documentation for the amp-audio and the audio events
<amp-audio preload="none" id="audio" controlslist="nodownload" hidden>
<div fallback><p>Your browser doesn't support HTML5 audio</p></div>
<source type="audio/mpeg" src="/media/shortSound.mp3">
<source type="audio/ogg" src="/media/shortSound.ogg">
</amp-audio>
The "native" audio button is hidden and is triggered by clicking the following button (with the on:tap event)
<div class="button" on="tap: audio.play" role="button" tabindex="0"></div>
I have also tried using absolute URLs in vain and using the pause function before play but to no avail.
Note: Unfortunately there is no .load event to circumvent the problem like with HTML5 on Safari (which is how I got to play it on Safari on the non-amp version)
Actual result: The sounds play once (the first time I click it). The rest of the time nothing happens, no message in the console either. What am I doing wrong?
I have found the issue was with the mp3 encoding of my files. It uses VBR instead of CBR, the problem doesn't happen when using CBR encoded mp3 files. To check your encoding I recommend using https://checkmate.gissen.nl/download.php
EDIT: IT was actually because Safari uses HTTPRange to get its resources instead of a classic get method.
Hopefully the loop attribute on <amp-audio> can help here: https://amp.dev/documentation/components/amp-audio/?format=websites

Vimeo autoplay not working Safari 11

I've loaded this embed code to our website on the homepage.
https://player.vimeo.com/video/254985863?autoplay=1&loop=1&autopause=0&background=1" width="1903" height="500" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
You can see the site here
The video autoplays perfectly everywhere except Safari. In Safari it just loads the cover image. I am guessing that safari 11 thinks the video has sound but it doesn't. Is there a setting to show safari that this is a muted video?
I believe this is a very recent Safari bug, possibly in 11.0.3 or 11.0.2. I've just reported this to Apple, please do the same so that they get on it: https://www.apple.com/feedback/safari.html
It's definitely treating the video as if it has sound - if you set the 'Settings for this website' to 'allow all autoplay' then it will work - which is useless because the default is 'Stop Media with sound'
We were experiencing the same issue with Safari (only) for background video and I have been paying close attention to this thread since it was raised back in February (I did report the issue to Apple as suggested) but upon checking the live site again today this is now working correctly once again.
Neither the Vimeo videos or website code has been changed but the videos are now playing in Safari as expected (previously it was displaying a static image only). I am still running the same version of Safari as I was before, when this was an issue (11.0.3), so I can only assume that something has changed on the Vimeo embed side of things. Perhaps they have updated the mute code.
It is now working correctly again, but I can find no mention of anything changing on the Vimeo side.
on https://www.apple.com/safari/
"Stop auto-play videos.
Safari prevents unexpected and unwanted videos with audio from automatically playing while you browse. Just click the play button if you want to view them. Have a favorite site where you always want videos to play? Use per‑site settings in Safari to enable media auto-play."

fixing transparent youtube control icons with existing links

Something happened few weeks ago that i was unable to tackle myself. There is no information regarding my problem so i have to ask for help.
We have a simple youtube videos embed in our site. However the control icons refuse to show except the one that controls the "mute". The links clearly exists as when you mouse over them you see the popup.
It is not a player size problem since i tried it all.
The problem didn't existed few weeks ago so this is something new and totally over my head. Please help.
I am including a link to a simple html with single embedded video that shows the problem. -> Here
The code itself is this:
<iframe src="http://www.youtube.com/embed?listType=search&list=madonna%20la%20isla%20bonita" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>
ps1. I have checked this with Edge and Safari and so far this problem only exists when videos are loaded by Firefox (43.0.4)
ps2. I have updated to Firefox 44.0 and problem still exists.

Soundcloud API with private player (not working)

I'm using the API wrapper Ruby Soundcloud.
I'm able to retrieve some soundcloud sounds & playlists info as well as update it.
Problem 1:
The "embeddable_by" doesn't update (it always stays at none even when I'm updating to "all" for example).
Problem 2:
If I set a sound to sharing:private (with embeddable_by:all), I get a "The sound can't be played outside of Soundcloud".
I do use the secret token in my url:
<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/<%= #audiofile.soundcloud_url %>%3Fsecret_token%3D<%= #sc_token %>&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe><br />
What's weird is that if I'm getting the embed code from the Soundcloud website (on the sound page), it works. Also magically it starts working with my custom embed code! Isn't it weird?
Any help will be appreciated!
Looks like "streamable" must be set to "true" to make it work :/