Video quality in Video View - android-studio

Here is code of web view to load video using URL
mediacontroller = new MediaController(this);
mediacontroller.setAnchorView(vv);
String uriPath = "https://firebasestorage.googleapis.com/v0/b/fire-b6fff.appspot.com/o/Nissan_-_Ignite_the_Excitement(1).mp4?alt=media&token=2f329bc8-7045-4f4e-a683-64169fc4562c"; //update package name
uri = Uri.parse(uriPath);
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
#Override
public void onCompletion(MediaPlayer mp) {
if(isContinuously){
vv.start();
}
}
});
How to set video qualities like 180p,360p like youtube in video view

You may find it easier to use ExoPlayer to do this:
https://github.com/google/ExoPlayer
It is supported by Google and also used as the basis for many mainstream android video players. Its described like this at the link above (at the time of writing):
ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend, and can be updated through Play Store application updates.
The Exoplayer demo application includes track selection as standard:
https://google.github.io/ExoPlayer/demo-application.html

Related

how to android camera record provider

I'm making a mobile app that takes a video with a camera and uploads it to a server.
I am using CameraX to record the camera.
But the video is saved in the gallery
val mediaStoreOutput = MediaStoreOutputOptions.Builder(
requireActivity().contentResolver,
MediaStore.Video.Media.EXTERNAL_CONTENT_URI
)
I knew how to set the video storage location here, so I tried to edit this place.
How can I save the video to the fileProvider without saving it to the gallery??

How to store content in a Hybris Media file?

In my application we are getting media like photos and Videos from third party and I want to store it in Hybris as a media ?
How can we upload Photos/Videos through the java code in a Hybris Media?
You can check my simple example. Not forget to add exception block. Check CatalogUnawareMedia and CatalogMedia before your implementation. If you are not planning to synchronize third-party objects use CatalogUnawareMedia.
// folder optional
final MediaFolderModel folder = mediaService.getFolder("myfolder");
final CatalogUnawareMediaModel media = getModelService().create(CatalogUnawareMediaModel.class); //or CatalogMediaModel
media.setCode(myFileName);
media.setFolder(folder);
getModelService().save(media);
mediaService.setStreamForMedia(media, myStream);
getModelService().save(media);

Document support (rtf, doc, docx) for UWP/Windows 10 Mobile

How can I display documents (doc, docx, rtf) in an UWP app? The WebView isn't able to do this.
Other options would be calling an external application with Windows.System.Launcher.LaunchUriAsync (e.g. Word) or using a 3rd party library. The requirement is to have the data in the app, because you don't have control over it, if it's handled to another one. Another option would be to convert it to another format (e.g. PDF) which UWP can handle (not really).
Any ideas?
If you would like to display word or pdf files in the UWP app you can use WebView control with Google Docs Viewer - I was using it for the online documents.
This is the code:
XAML:
<WebView x:Name="MyWebView"/>
Code behind:
public WebViewPage()
{
this.InitializeComponent();
loadWebView();
}
void loadWebView()
{
var googleDocsViewer = "http://drive.google.com/viewerng/viewer?embedded=true&url=";
var pdf = "http://www.uma.es/precarios/images/pdfs/wd-spectools-word-sample-04.doc";
MyWebView.Navigate(new Uri(googleDocsViewer + pdf));
}
I did not test it with local files, but I think that should also work. Please try and let me know.
UWP can actually handle RTF files with RichEditBox - for more info about that see here in the official documentation (I don't know about RichTextBlock). For Docx support I can recommend a third-party library by Syncfusion, which you can get for free if you meet certain requirements.

Unable to open Google Play store with Xamarin.Forms Portable class Library

Currently I use this to try and open the Google Play Store directly to my app however this does not work.
var intent = new Intent(Intent.ActionView, Uri.Parse("market://details?id=" + appPackageName));
In a Forms PCL project, you can open a URI by using Device.OpenUri()
Device.OpenUri(new Uri("http://www.google.com"));

Default instance(maybe static) of Messenger plugin like MVVM Light

Is there an equivalent in MVVMCross to MVVM Light's Messenger.Default instance(for standalone projects that don't comply with MVVM in Xamarin.iOS).
After looking at threads such as this, this, this
I decided to add the "MvvmCross Messenger" plugin to the PCL and iOS project. Thought I'd have to register the Hub and resolve it from the PCL and iOS projects with something like
// Registering in ViewDidLoad() of iOS project
Mvx.RegisterSingleton<IMvxMessenger>(new MvxMessengerHub());
// Try to resolve and subscribe in PCL and iOS project - both have nuget packages added
_messenger = Mvx.Resolve<IMvxMessenger> ();
_token = _messenger.SubscribeOnMainThread<MyMessage> ((message) => {
OutputLabel.Text = message.Number;
});
However I get a null reference exception right at Mvx.RegisterSingleton. Not too sure what I'm missing. All I'm looking for is the Messenger to function. Do not want any other part of MVVM in this project for now
In MvvmCross we made our messenger optional - so it's in a plugin.
If you want to use it standalone, then you can boot the plugin system using code like that shown in the CrossLight demos - see N=30 and N=39 in http://mvvmcross.blogspot.co.uk/ - and see the android-only demos in https://github.com/MvvmCross/MvvmCross-Tutorials/blob/master/CrossLight/PluginUse/NoBinding/Setup.cs
For iOS, you'll probably need some one-time init code something like:
if (MvxSimpleIoCContainer.Instance != null)
return;
var ioc = MvxSimpleIoCContainer.Initialize();
ioc.RegisterSingleton<IMvxTrace>(new MvxDebugOnlyTrace());
var manager = new MvxLoaderPluginManager();
var registry = new MvxLoaderPluginRegistry(".Touch", manager);
ioc.RegisterSingleton<IMvxPluginManager>(manager);
The code for the messenger itself is in: https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/Messenger/Cirrious.MvvmCross.Plugins.Messenger/MvxMessengerHub.cs
Alternatively... if you don't want Mvx code for binding, dispatcher, etc, then it's probably easier to just use something like the excellent TinyMessenger - https://github.com/grumpydev/TinyMessenger

Resources