How can I activate subtitles by default in the Dailymotion embedded player for any language - dailymotion-api

Dailymotion embed URLs can activate subtitles by default:
https://www.dailymotion.com/embed/video/x7n59nb?subtitles-default=en
But the embed player needs to know the language for that.
It would be nice to be able to activate subtitles regardless of language for the
video software I am using, as I don't want to store the language for every video.
Is there a way to activate just any subtitle eg:
https://www.dailymotion.com/embed/video/x7n59nb?subtitles-default=any (or first)
Or to give the player a list of possible subtitles:
https://www.dailymotion.com/embed/video/x7n59nb?subtitles-default=de,en

It's not possible to directly activate subtitles with a random value.
With an API call you can retrieve the list of available subtitles for a specific video by using the endpoint: https://api.dailymotion.com/video/{id_of_video}/subtitles Documentation
If you are in a browser, you can maybe use the navigator.language to set the value of the subtitles.
With the dailymotion-sdk-js (Documentation), you can use the events to set your subtitle randomly:
var player = DM.player(document.getElementById("player"), {
video: "x7n59nb"
});
player.addEventListener('playback_ready', function (e)
{
if(e.target.subtitles.length > 0){
var random = Math.floor(Math.random() * Math.floor(e.target.subtitles.length));
playlists.setSubtitle(e.target.subtitles[random])
}
});

Related

autodesk-forge add hyperlink to object in a360 viewer

Need to find way to add hyperlinks to components of an assembly in the a360 viewer such that, when clicked or touched with mobile device, will navigate to a web page for more information. Realize it requires Forge API but can't find any specific examples of such a solution. I think this can be done from a properties table but I want direct navigation from touching/clicking the object.
You could just subscribe to the object selection event and react to it by e.g. opening a given URL:
viewer.addEventListener(
Autodesk.Viewing.SELECTION_CHANGED_EVENT,
function (event) {
// Get id of first selected item
var dbId = event.dbIdArray[0];
if (dbId) {
// Maybe get the properties of the selected object
viewer.getProperties(dbId, function (props) {
// Depending on the properties you could open a website
// Just printing to the console the external id of
// the selected component as an example
console.log(props.externalId);
});
}
}
);
If you search for "Autodesk.Viewing.SELECTION_CHANGED_EVENT" you can find some articles and samples also using this event, e.g. https://forge.autodesk.com/blog/selection-override

typo3 tsconfig url parameters media

We are using Typo3 7.6.
We use a simple text and media Element to embed youtube videos.
Those youtube video-embed links do need paramters (like rel=0), but I see no option to imput them and I do not find any typoScript where I can set those parameters in any help. Putting the paramters directly into the URL that I enter in the element does not work, merely the ID is parsed.
Is there a simple way to do this?
You need to set buttons.link.queryParametersSelector.enabled to true in your page TS-Config.
To do this edit your rootpage(normally id=1) and go to tab Resources.
Fill in the following code to the field Page TSConfig.
RTE.default.buttons.link.queryParametersSelector.enabled = 1
After saving you should see an additional field called "Additional link parameters" when you use the link wizard.
Reference: EXT: rtehtmlarea -> buttons.link.queryParametersSelector.enabled
I assume you use fluid styled content? If so, the gallery processer could be configured via TypoScript setup like this:
lib.contentElement.settings {
media {
additionalConfig {
no-cookie = 1
modestbranding = 1
relatedVideos = 0
showinfo = 0
}
}
}

Initializing an empty player with Youtube Javascript API

I have made a component for my web app that initializes a YouTube player on the page. This player will be used to an un-demand video on to the page. However, when initializing the player, I have to pass a video for it to initialize:
//javascript
swfobject.embedSWF( makeUrl( 'http://www.youtube.com/v/NINOxRxze9k', {
version : 3,//youtube api version
autoplay : 0,//automatically start playing
color : 'white',//color for the 'viewed' part of the video
autohide : 0,//automatically hide the controls
controls : 0,//don't show the controls
disablekb : 1,//disable keyboard shortcuts
enablejsapi : 1,//enable javascript api
fs : 0,//disable full-screen
playerapiid : id,//player api id that is used for javascript api
//playlist : videoIds.join( ',' ),//the list of video ids to play (it can be only one item)
showinfo : 0,//don't show video information like title
rel : 0,//don't show related videos after playback is finished
theme : 'light',//use the light theme (the other one is 'dark')
showsearch : 0, //don't show the search bar (it's disabled when 'rel' is 0)
origin : window.location.hostname//it is a security thing necessary for enabling javascript api
}), id, '300', '200', '8', null, null, params, atts);
(notice the 'NINOxRxze9k' part on the first line).
The question is: how can I initialize a YouTube player without initializing it for a specific video? I don't want it to show a snapshot of the video ready to be played. I want it to be blank before I start playing anything on it.
Sitenote: as you can see from Google's documentation, the VIDEO_ID is passed to embedSWF(). I tried removing it but it stopped working.
I think that this is the answer to the same question, but if you use the Player IFrame API:
Init YouTube iframe player without video ID
Not sure if this will help but here it is anyway.
I have played with YT-api for a while in flash and web for different projects and found it to be a LARG system that takes a lot of reading.
The only time I have found it to have a blank player loaded was in a flash app. Also it needed to be chromeles.
I did an "amature" tutorial with download for people here.
http://www.youtubetutsite.com/player.php?videoID=kO_WVIYdLDc
Only sugesting as you are using the SWF player in your app.

Photoswipe Custom Hashtag Immediately Closes Slideshow

Testing on the desktop with JQM doesn't produce this issue, so it's difficult to pinpoint.
Backstory: I have created server side code (php) to accept a query string and open a gallery straight to a picture. But if a user wants to share a link while surfing a gallery on a mobile device, and in particular a certain photo; most Mobile Browsers share the core link and not the actual photo. It's easy in the events when swiping to create a URL hashtag modifier for the URL with the photo id ( For example #photoID=987), but only if the gallery is originally started with no hashtags. It's then easy to share with a Phone's Native methods.
(function(window, $, PhotoSwipe){
$(document).ready(function(){
//More Code is here but not needed fro this question
$(photoSwipeInstance).bind(PhotoSwipe.EventTypes.onDisplayImage, function(e){
var pid = codeThatGetsPhotoIDFromDisplayedIMGURL();
window.location.hash = '&pid='+pid[0];
});
if(getUrlVars()["pid"]!=null || getUrlVars()["pid"]!=undefined)
{
console.log(getUrlVars()["pid"]);
var photopid= getPhoto(getUrlVars()["pid"]);
photoSwipeInstance.show(photopid);
}
});//End Documentstrong text
}(window, window.jQuery, window.Code.PhotoSwipe));
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
Issue: If a gallery is loaded with a hashtag the gallery will pop up the proper image but then immediately closes the slide show. And every photo past this point performs in the same manner, slideshow opens then closes.
I have turned off all AJAX, and hashtag anchor functions JQM utilizes. This hashtag url functions works as intended when using a Desktop browser but not when using any Mobile browser.
Has someone else tried this functionality?
I probably made this much more confusing then it is in my description.
Answer: JQM's hashtag handlers did not need to be turned off instead. Photoswipe needed this handler added to the options: backButtonHideEnabled: false
JQM's hashtag handlers did not need to be turned off instead. Photoswipe needed this handler added to the options: backButtonHideEnabled: false

Prevent YouTube auto-play with Fancybox?

If I Fancybox the youtube link (as opposed to embedding the code as normally w/o fancybox) how can I avoid autoplay on pageload?
I want to be able to click the image for it to start playing.
http://www.estherwarda.com/wci/homepage/
If you're using the latest version of Fancybox (2+), YouTube and Vimeo are now recognized and handled quite well.
However, it took some digging around to find this out since most documentation is on Fancybox 1.
Fancybox strips your YouTube URL and adds some default parameters:
autoplay=1 (videos will autoplay)
autohide=1 (control will hide once video is playing)
fs=1 (fullscreen is enabled)
rel=0 (related videos are hidden)
hd=1 (HD playback is enabled)
wmode=opaque (fixes z-index with YouTube and lightboxes)
enablejsapi=1 (enables Javascript API)
What this means that normally you could pass those parameters in your URL and have them apply, but Fancybox 2 ignores those and falls back on the preset values.
Don't dismay! You can override those in your script. Several ways.
Normal media embed:
$(".fancybox").fancybox({
helpers : {
media: true
}
});
Custom URL parameters method 1:
$(".fancybox").fancybox({
helpers : {
media: {
youtube : {
params : {
autoplay : 0
}
}
}
}
});
Custom URL parameters method 2:
$(".fancybox").fancybox({,
helpers : {
media: true
},
youtube : {
autoplay: 0
}
});
Look in the helpers > jquery.fancybox-media.js file for more details (check the comments). Fancybox 2 also supports a variety of URL formats so you don't need to worry about which URL version you should be using (i.e. youtube.com/watch?v=### vs. youtu.be/###).
It's about your embed code. Youtube's old default embed code looks like that: http://www.youtube.com/v/bla?version=3. It can be take autoplay parameter that controls the playing on loading. You can push back &autoplay=0 to http://www.youtube.com/v/bla
http://www.youtube.com/v/bla?version=3&autoplay=0

Resources