Youtube Videos inside WWSD - genexus

I use one attribute based on Video domain where I add the Youtube urls to be load in the WWSD or SDPanels.
I got my Youtube ID and everything is OK in Android, but in iOS the video is not load and keep Loading message.
Anyone know if is need do something more for iOS in GNX to solve it ?
thx.

Currently Youtube links to be used in the control Video for iOS must use the watch?v=VIDEOID URL format, like in: http//www.youtube.com/watch?v=8GzZ-kMHqUA . youtu.be host name is also accepted.
iOS generator internally converts the URL to the http//www.youtube.com/embed/VIDEOID format removing any additional parameters.
If you want to include additional parameters, you can use the solution provided by Franklin.

For iOS we did a work around because we found the same problem.
In youtube you can find the URL of the video to play directly. For example: https://www.youtube.com/embed/8GzZ-kMHqUA?autoplay=1
After having that url for the video you can create an SDPanel with a variable of type Component. In the list of the video, you can call this SDPanel and load the url of youtube video. This way the user will have the ability to play the video from a the web page that will trigger the native video player in iOS without an extra tap.
Code example:
Event "GridTapFromWWSD"
Composite
PanelYoutubePlayer(VideoURL)
EndComposite
EndEvent
In the panel: PanelYoutubePlayer you ll put a &variable based on the Component domain and in the Layout give this variable 100% (height, width) and set it as ReadOnly = true.
Assuming you have a table like with: VideoID | VideoURL
You can get the VideoID on the parm:
parm(in:&videoID);
And in the panel create in the events the following:
Event Start
for each
where VideoId = &videoID
&videoUrlComponent = VideUrl
endfor
EndEvent
This way you can navigate your db table to get your video URL.
&VideoID -> Same Domain as your VideID att
&VideUrlComponent -> ComponentDomain

Related

xamarin forms webview.eval return type is voide . How to retrieve user input data?

I am working on xamarin.forms. I have a content page which contains one webview which load 3rd party url(www.xyz.com) site and one button in shell.
On button click event I am trying to get user input data using
webview.eval(javascript: var data = document.getElementById('first-name').value;alert(data)).
It works fine but due to void return type I could not store data in local variable and I have a customrender(webviewrender) but don't know on shell button click event how can I get userinput data from webview
Please suggest me how do I achieve this functionality.I do not want XLab-Hybridwebview.
You'll probably need to have the JavaScript code call out to the external code when the result is available. You could then wrap that whole process in a TaskCompletionSource to make everything nice and easy to use.

How to post images and videos on Instagram using Xamarin. iOS

How can I post images on Instagram similar to SLComposeViewController using c# in a Xamarin.iOS application.
I dont think you can share extra text like in SLComposeViewController with Instagram or Facebook.
Have a look here
Might be best with a UIActivityViewController and add the image to activityItems like in this answer https://stackoverflow.com/a/32783758/1107580
There are two ways at the moment how can you share pictures from your app to Instagram:
Save the picture to your Camera gallery. Open Instagram app using URL #"instagram://camera". It opens Instagram app directly whit pictures sorted by the date of creation and yours one will be the first.
Open action sheet using UIDocumentInteractionController. After user selects Import in Instagram, the Instagram's share flow starting with the cropping will pop out.
Here is the code in Xamarin for the second option:
UIImage imageToUse = _your_ui_image_instance;
NSString documentDirectory = (new NSString(Environment.GetFolderPath(Environment.SpecialFolder.Personal)));
string saveImagePath = documentDirectory.AppendPathComponent(new NSString(#"Image.ig"));
NSData imageData = imageToUse.AsPNG();
imageData.Save(saveImagePath, true);
NSUrl imageURL = NSUrl.FromFilename(saveImagePath);
DocumentController = new UIDocumentInteractionController();
DocumentController.Url = imageURL;
DocumentController.Uti = "com.instagram.photo";
DocumentController.PresentOpenInMenu(new RectangleF(1, 1, 1, 1), View, true);
Remember to declare DocumentController as a class' field instead of a local property (error will be arisen once PresentOpenInMenu will be executed for losing the UIDocumentInteractionController too early).
You can alternatively show much fewer apps in the action sheet using uti com.instagram.exclusivegram and extension .igo.

Start Brightcove video onclick

The following code loads the video when clicking on a link but how can I get the video to actual play when clicking instead?
<a class="test" onClick="BCL.addPlayer('video_player', '2102405248001');" href="#">Test</a>
Thanks!
You will need to use the API for the VideoPlayer module. Have a look at the play() method. When onTemplateLoaded() is triggered, you can call Play(). Conversely, you may be able to set the video to autoStart. Check here for player config params.

Brightcove video thumbnails

Assuming I have the video IDs can I access a still of the video?
I have read of the media API and the read functions for thumbnailURL and videoStillURL but have no idea how to implement.
Are there examples of using a still from an asset given the ID?
Yes, most all of the Media API read methods will return the videoStillURL and thumbnailURL if you specify them in the video_fields, or just return all fields. Once you get the URL, you can use it as the src value for an tag or you can browse to the URL if you want to download the image. There are many examples on the Brightcove sites of using these URLS to populate image tags src values -- see http://solutions.brightcove.com/bcls/AnalyticsAPI/most-popular-videos.html for example.
Yes, you can get thumbnail image url of a BrightCove video from player instance. Which means when a player is loaded and we get instance object of player (e.g. playerInstance), we can get the thumbnail url from playerInstance.mediainfo.poster.
mediainfo can't be called directly when player is loaded because video information loads after the player is initialized so we need to wait for mediainfo object to have required information. Hence we need to call playerInstance.mediainfo.poster on loadeddata event. Please refer the code example underneath.
// After loading BrightCove script
i.e. https://players.brightcove.net/[ACCOUNT_ID]/[PLAYER_ID]_default/index.min.js
// Initialise player using videojs object
let playerInstance;
videojs.getPlayer('[ID_PROVIDED_IN_BRIGHTCOVEPLAYER_ELEMENT]',).ready(() => {
playerInstance = this; // Assigning player instance
playerInstance.on('loadeddata', () => {
console.log(playerInstance.mediainfo.poster); // Thumbnail URL
});
});
But if you need thumbnail image before you initialise Brightcove player, there is no exact way to get it from the same API. There is another API provide by brightcove, please refer the same. https://apis.support.brightcove.com/playback/code-samples/thumbnail-grid.html

Uploading single image and showing its thumbnail using jquery and asp.net mvc3

I need to upload the photo of a user with his details from asp.net mvc3 razor view. The image selected by the user has to be shown as thumbnail before submitting the form.
The model of the view contains a byte array property called Photo. On page load i am converting this byte array to base 64 string and showing it in . this is working properly .
Now i need to show the thumbnail of the image selected by the user. And when he clicks on submit button i need to bind the selected image to the model property Photo.
After googling , i came to know that showing thumbnail is not possible until I upload that image. I tried Uploadify but its UI behavior is not what i am expecting. I also tried the article http://www.dustinhorne.com/post/2011/11/16/AJAX-File-Uploads-with-jQuery-and-MVC-3.aspx, but it is also not suitable in our scenario.
can anyone help me by sharing their experience achieving this scenario.
Thanks in advance.
You could achieve this using HTML5 File API. Take a look at the following article and more specifically the Showing thumbnails of user-selected images section which illustrates an example of how you could achieve that without uploading the image to the server.
And if you want to support legacy browsers that do not yet support the HTML5 File API you could use the jQuery.form plugin which allows you to easily send the contents of a given form to the server using AJAX and it also supports file uploads. So basically you could subscribe to the .change() event of the file input or the .click() event of some see thumbnail ... button and then submit the form to a controller action using AJAX:
$('#myform').ajaxSubmit({
url: '#Url.Action("thumbnail")',
success: function(result) {
// the result variable will contain the result of
// the execution of the Thumbnail action.
// could be a BASE64 encoded representation of
// the thumbnail you generated on the server and then
// simply set it to the src property of your preview `<img>`
// element using the Data Uri scheme
}
});

Resources