OpenTok fragment Video publishing with MvvmCross - xamarin.android

I'm trying to implement video streaming with OpenTok video streaming solution, based on MvvmCross architecture (Android app).
My video page is a MvxFragment, that is instantiated from MvxCachingFragmentCompatActivity. That activity manages a couple of fragments, and on custom command it shows my video fragment.
The problem is that i receive video and audio from subscriber, but unable to send the publisher data. Publisher view always shows black screen.
Here is my publisher creation block:
public void OnConnected(Session p0)
{
if (_publisher != null)
return;
_publisher = new Publisher(Activity, "publisher", true, true);
_publisher.SetPublisherListener(this);
AttachPublisherView(_publisher);
p0.Publish(_publisher);
}
But if i am not using mvvmcross, and implement OpenTok interfaces in FragmentActivity, instead of fragment, everything works fine.
I suppose that, the problem somehow depends on the provided context when i create Publisher, but cannot find the way to get it work.
Will be thankfull to any thoughts or help.

Finally i found what caused the problem. It was incompatible target android version. After i set it to "Use compile using SDK version" the problem is gone.

Related

Single Image picker in Flutter on iOS without permission

According to those SO questions: UIImagePickerController not asking for permission and No permission to pick a photo from the photo library
If you want to select one image on iOS, you don't have to ask for permission to do it as the app doesn't actually access the gallery.
However, I can't find a way of doing it Flutter. Packages like ImagePicker always ask for permission.
Has anyone succeeded in picking an image in Flutter on iOS without asking for permission?
From Apple documentation:
PHPickerViewController is a new picker that replaces UIImagePickerController. Its user interface matches that of the Photos app, supports search and multiple selection of photos and videos, and provides fluid zooming of content. Because the system manages its life cycle in a separate process, it’s private by default. The user doesn’t need to explicitly authorize your app to select photos, which results in a simpler and more streamlined user experience.
This library uses PHPickerViewController as seen here
The old UIImagePickerController allowed it on older iOS'es, but it has been deprecated, since iOS 14.
The Flutter ImagePicker plugin uses the PHPicker in the iOS code, as I checked for their code on Github, and it allows you to pick an image from the user without requesting permissions. I recommend highly to use that plugin.
Try file_picker it should work for you as it supports all the platform including IOS and Mac supporting various types of file type, you can specify your custom file types also limiting your file selections as well as you can pick files from cloud (GDrive, Dropbox, iCloud)...
First of all add the latest file_picker as a dependency in your pubspec.yaml file.
Import this dependency in file wherever you want to use and then you are good to go...
for picking single file use this code:
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
File file = File(result.files.single.path);
} else {
// User canceled the picker
}
files with extension filter:
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'pdf', 'doc'],
);
You can find detailed usage Here
you can find the documentation Here

How to prevent reload on Tizen Public Preview Deeplink?

I'm writing a web app for Tizen Smart TV. One of the required features is implementing the Smarthub Public Preview deeplinking.
I have setup the app to open at a specific content when the Public preview tile is clicked. However, I cannot prevent the app to reload. The documentation mentions adding the appcontrol event to the window event listeners, but I don't think this event is being recognized by the app, since the code is not executed.
It only works if I directly add my deeplink() method to the onload property.
According to documentation, this piece of code should prevent the app to reload, but it is not working:
<tizen:app-control>
<tizen:src name='index.html' reload='disable'></tizen:src>
<tizen:operation name='http://samsung.com/appcontrol/operation/eden_resume'></tizen:operation>
</tizen:app-control>
window eventListener is not working wither:
onload="window.addEventListener('appcontrol', deepLink)"
Any help on how to implement this correctly?
Thank you in advance
You are probably modyfing window.location in the app (ie in router).
reload='disable' prevents reloading index.html. When application receives app control request and page is different, application will be reloaded.
You can find more about appcontrol in Tizen documentation (note that Tizen for TV may differ from other devices):
https://docs.tizen.org/application/web/guides/app-management/app-controls/
I've got some information regarding your question.
To do application resume without Page reload,
Set extra data in app-control like below
key: SkipReload
value: Yes

iOS Shoutcast access metadata using Swift

Ok so I've looked at many similar stack questions but none of them worked or were too old to even be considered.
Here is the stream adres if that's important: http://51.255.8.139:8822/stream
NOTE: I'm new to iOS programming and this is my first project.
I used AVFoundation. AVAsset to enclose URL and AVPlayer to play it. That works.
I can't however get any metadata from the stream. Like current song name.
Notable things I tried:
asset.timedMetadata nothing there
official apple tutorial availableMetadataFormats was empty
playerItem!.observe(\AVPlayerItem.timedMetadata, options: .new) {
(player, change) in print(change)
}
also empty
For anyone who wants to do the same,
I got the answer on apple developer forum https://developer.apple.com/forums/thread/650170
But basically timedMetadata should work, (prior to iOS 14 it will only give stream name).

Play youtube video as a hololgram

Is there any way to open a window and playing a youtube video inside my hololens app?
I did search about opening youtube video page, but it will open outside of my, i want player to be inside of my app.
For HoloLens 1, the suggestions provided by Hernando in the comments are good.
I wanted to also share that it is possible to do this on HoloLens 2 and Windows Mixed Reality simply by launching a URI. This will launch a flat application window directly in your unity app. For example, have a look at "the Launch External Apps pull request" which shows the behavior in the HandInteractionExamples scene (available in MRTK RC2 release, or latest mrtk_development branch).
The code to launch an external URI within your app is as follows:
#if WINDOWS_UWP
UnityEngine.WSA.Application.InvokeOnUIThread(async () =>
{
bool result = await global::Windows.System.Launcher.LaunchUriAsync(new System.Uri("https://youtu.be/SB-qEYVdvXA"));
}, false);
#else
Application.OpenURL("https://youtu.be/SB-qEYVdvXA");
#endif
This code was taken from LaunchUri.cs, modified to just launch a YouTube video.

SoundCloud Widget External Control iOS issue

I have found a bug using the external controls for the html5 widget on iOS, i have tested with iphone and ipad. The controls inside the widget work ok. However on my clients site http://www.bushytunes.net and the widget api playground http://w.soundcloud.com/player/api_playground.html the external controls run an error.
Here is what the console from the widget playground prints:
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PAUSE {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.READY {}
Loading...
Thanks, James
TL;DR: iOS 6 should work with a limitation of a call to play to be init by user action, iOS5 and below probably won't get a fix.
We'll try to resolve this with some kind of a hack, but most probably this won't get a proper solution any time soon.
SoundCloud Widget is using HTML5 Audio to play sounds on iOS. There are two limitations on starting playback in iOS:
Playback must be started by user action (so within event handler)
The call to audio.play method has to be within synchronous call stack of that event handler.
This means, that this works:
document.querySelector('.play-button').addEventListener('click', function () {
audioController.play();
}, false);
But this doesn't:
document.querySelector('.play-button').addEventListener('click', function () {
setTimeout(function () {
audioController.play();
}, 500);
}, false);
Cross-domain communication between iframes is only possible in asynchronous manner. Our implementation is using postMessage DOM API, but even older techniques such as Fragment Identifier Messaging (FIM) that is using location.hash are asynchronous. This means we don't currently see a way of enabling playback through API for iOS5 and below (as there is also no Flash fallback).
However, there are also good news: iOS6 has dropped the limitation No2. This means that as long as the API call to play is called by user action, you'll be able to play sounds. Even though the communication between your parent window and widgets' iframe is still async. Unfortunately iOS hasn't dropped this limitation.
I hope this helps and I'll update this answer in case we find a proper workaround.
My suggestion would be to build your own custom player with a library like Audio5JS or SoundManager2 in case controlling playback on iOS is crucial for your app.
You can see vague description of what I am talking about on developer.apple.com resource.
I can't completely tell if #gryzzly is trying to say this, but the Widget API's external controls are completely broken on mobile. The answer does explain why -- you can't synchronously tell the iFrame to play the sound, but it is my understanding that proper iframe.contentWindow calls would be synchronous? I may be wrong.
Try directing your mobile phone to the widget API playground: https://w.soundcloud.com/player/api_playground.html
Even there it doesn't actually play unless you press the orange button.
Pretty irritating since there's no application to get around the streaming API limit either. There seems to be literally no way to get a site that may experience more than 15,000 requests/plays per day to work with SoundCloud on mobile. I just want continuous music playback.

Resources