When I configured Twilio programmable video using following code:
Video.connect(token, {
name: roomName,
audio: true,
logLevel: 'info',
maxAudioBitrate: 16000,
video: { frameRate: 30, width: 1260, height: 650, controls: false },
})
In some of the devices such as Ipad tab or mobile phones, user is connecting to back camera instead of front camera of device.
Is there a way for us to specify the constraints to make sure Twilio video is always connecting to only front camera. Thanks!
Twilio developer evangelist here.
I wrote about how to select cameras in JavaScript here. If you are trying to ensure you select a user facing camera, then you want the facingMode constraint. Set facingMode to user and you will select user facing cameras on a system that supports it.
Video.connect(token, {
name: roomName,
audio: true,
logLevel: 'info',
maxAudioBitrate: 16000,
video: {
frameRate: 30,
width: 1260,
height: 650,
facingMode: "user"
},
});
Note that I don't believe controls is a valid media constraint, so I have removed that from the code above.
Related
A small percentage of our users don't seem to have a default live broadcast on YouTube even though live streaming is enabled on their channel.
Here's the query I'm using:
youtube.liveBroadcasts
.list({
part: 'snippet,contentDetails,status',
mine: true,
broadcastType: 'persistent',
})
Here's a normal response:
{ kind: 'youtube#liveBroadcastListResponse',
etag: '"XI7nbFXulYBIpL0ayR_gDh3eu1k/tnMgqhFvImsLcGAkkJ86gMVeu7o"',
pageInfo: { totalResults: 0, resultsPerPage: 5 },
items:
[ { kind: 'youtube#liveBroadcast',
etag: '"XI7nbFXulYBIpL0ayR_gDh3eu1k/FqKww8uAZT-v7cY4LAc70S74LZE"',
id: 'jW9y9FCovHs',
snippet: [Object],
status: [Object],
contentDetails: [Object] } ] }
But for some channels, it returns an item with no data:
{ kind: 'youtube#liveBroadcastListResponse',
etag: '"XI7nbFXulYBIpL0ayR_gDh3eu1k/6A_Pgj2FJo4w0Hg6io_OE8jCrzY"',
pageInfo: { totalResults: 0, resultsPerPage: 5 },
items:
[ { kind: 'youtube#liveBroadcast',
etag: '"XI7nbFXulYBIpL0ayR_gDh3eu1k/vyGp6PvFo4RvsFtPoIWeCReyIC8"' } ] }
These users will often have other past live broadcast, but no default.
The snippet.isDefaultBroadcast section in the docs says that each channel with live streaming enabled should have a default broadcast. Any ideas? Is there something different about certain channels that would cause this?
You can read the documentation about how default broadcast work. It says that when a channel starts streaming video to its default stream, the video is visible on the channel's default broadcast. When the stream ends, YouTube converts the completed broadcast to a YouTube video and assigns the video a YouTube video ID. I think this will only modify by the owner of the channel.
Via the Youtube API, how can I detect if a video Youtube is unavailable (ex : https://www.youtube.com/watch?v=5nRZlcB2jPY) ?
Thanks
This is also partially possible without API. Let's say you want to see if the following video is available:
https://www.youtube.com/watch?v=esDJPiGu5x0
The ID of the video is shown as the GET parameter v. Use this one to request the following thumbnail:
https://img.youtube.com/vi/esDJPiGu5x0/0.jpg
If the content of the response has a length of 0 and/or the http response code by youtube.com is 404, then the video is not available anymore.
You would make an API call for the video status.
https://www.googleapis.com/youtube/v3/videos?id=VIDEOID&part=status&key=APIKEY
Then check the uploadStatus in the json result:
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": true
}
Here is my code, please help.
jwplayer("myElement").setup({
playlist: [{
sources: [{
file: "rtmp://draco.streamingwizard.com/wizard/_definst_/demo/sample.mp4"
}],
image: "vtts/bbb-splash.png"
}],
width: 480,
height: 270,
type:"video/mp4"
});
You're using RTMP, which is a Flash protocol. There is no Flash on any mobile device. You'll need to provide an HLS stream or MP4 fallback for mobiles.
I've done a few hours of reading about writing an application that queries the twitter API and authenticates with OAuth, but they all seem too complex for my simple task at hand:
I have a handful of customer websites, all showing their twitter feed on the home page, all running on the same server. I do this by consuming the RSS feed of their tweets and output their latest tweets, formatted as HTML.
The problem is that as I gain more customers, I end up hitting the request limit near the end of the hour.
If I instead do an oauth authenicated API request for each customer, that will get me around the rate limit, but it seems overkill. I have to get every customer to give me an oauth key, just to show their tweets on their website? Can they even give me a key that lasts for ever?
All the oauth examples I've seen on the internet are for applications that do oauth requests all day, applications that will post to people's twitter feeds for them, etc. My needs are much more simple, and I'm hoping someone has a simple answer.
The easiest way is to use the pre-built Twitter Widgets.
You will not need to use OAuth - there are no rate limits.
The basic code looks like
<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 4,
interval: 30000,
width: 250,
height: 300,
theme: {
shell: {
background: '#333333',
color: '#ffffff'
},
tweets: {
background: '#000000',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
behavior: 'all'
}
}).render().setUser('edent').start();
</script>
You can create and customise a widget which shows all of a user's tweets directly from the Twitter website.
I have used a tutorial http://www.devcurry.com/2010/06/load-page-dynamically-inside-jquery-ui.html to dynammically load an aspx page into a jquery ui dialog without using an iframe
eg.
$(function() {
$('<div>').dialog({
autoOpen: true,
modal: true,
open: function() {
$(this).load('Example.aspx');
},
height: 400,
width: 400,
title: 'Dynamically Loaded Page'
});
When I debugged this page it just loading a blank dialog box with none of the content in even though the page has content. I have written it with the paths
eg $(this).load('/Home/Example.aspx');
I have even added in a function to check if it is loading
eg $(this).load('/Home/Example.aspx', function(){alert(Load Successful);}); which does return true YET still no content in the dialog
I am using Jquery 1.3.2 an ui 1.7.3 with ASP.Net Mvc
I know there are lots of questions/answers on this topic on stackoverflow but none of them seem to be successfully answering my problem and as these questions seem a year old not sure whether someone will get back to me asap.
Any ideas on showing the content in the dialog
Thank you
Just a thought, try changing your selector to
$('<div></div>').dialog({
Also the example you cited is using jquery 1.4.2 and jquery ui 1.8.1,
can you upgrade?
Edit:
You could also try it this way.
$(function() {
$('<div></div>').load('Example.aspx', {},
function(data) {})
.dialog(
{
autoOpen: true,
modal: true,
height: 400,
width: 400,
title: 'Dynamically Loaded Page'
}).dialog('open');
});
Note I haven't tested this, but its the way I do it. Hopefully you get the idea.
The answer is...
$(function() {
$('<div></div>').hide().load('Home/Example #content_form', function() {
$(this).dialog({
autoOpen: true,
modal: true,
height: 400,
width: 400,
title: 'Dynamically Loaded Page'
})
})
With Example.aspx having a tag with ID = content_form