How to loop a video through the youtube app - android

I'd like my application to launch a specific video from the youtube app and automatically restart (loop) the video after it's finished.
I tried the following:
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/v/" + youtubeID + "&loop=1&autoplay=1"));
startActivity(intent);
It works well in the browser, but will not automatically restart in the youtube app.
Is it possible?
Thanks.

Youtube app won't give you this option, it is possible tho with a well crafted hack,
but will take you ages to develop.
I don't know why you want it but i don't think it's worth the time.

Related

Playing sounds sequentially on android's google chrome (given the new restrictions on playing sound)

I have a small app that plays sequential sounds (a teaching app playing the sillables of a word)
This could be accomplished by firing an event right after each sound stopped playing. Something like:
var sounds = new Array(new Audio("1.mp3"), new Audio("2.mp3"));
var i = -1;
playSnd();
function playSnd() {
i++;
if (i == sounds.length) return;
sounds[i].addEventListener('ended', playSnd);
sounds[i].play();
}
(source)
However, now android chrome has implemented some new restrictions on how to play sound: Sound events must all be fired by a user action.
So, when I run code very similar to the above, the first sound plays, and then I get
Uncaught (in promise) DOMException: play() can only be initiated by a user gesture.
How can a sequence of sounds, determined at run time, be played on Android's Chrome?
To start with, Google Chrome on Android has been having the limitation of not allowing applications to play HTML audio(s) without an explicit action by the user. However, it is different than how stock browser(s), in most cases, handles it.
The reason, as Chromium Org puts it, is that, Autoplay is not honored on android as it will cost data usage.
You may find more details on the same here.
Apart from the fact that this results in wastage of bandwidth, this also makes some sense, since mobile devices are used in public and in houses, where unsolicited sound from random Web sites could be a nuisance.
However, in the later versions, this idea was over ruled and Chrome on Android started allowing autoplay of HTML audios and videos on it. Again after a set of reviews and discussions, this feature was reverted to what it was, making it mandatory for a user action to invoke HTML audios and videos on the Chrome for Android.
Here is something that I found more on the same. As it says, the reason stated was that "We're going to gather some data about how users react to autoplaying videos in order to decide whether to keep this restriction". And hence the playing option without a user action was reverted back.
You can also find more about the blocking of _autoplay of audio(s) and video(s) here on Forbes and The Verge.
However, this is something that I can suggest you to try which will help you achieve what you intend to. All you have to do is copy this code and paste in your Chrome for Android. This helps you reset the flag which is default set to not allowing to play HTML audios and videos without user interaction:
chrome://flags/#disable-gesture-requirement-for-media-playback
OR
about:flags/#disable-gesture-requirement-for-media-playback
If the above procedure doesn't help/work for you, you can do this:
Go into chrome://flags OR about:flags (this will direct you to chrome://flags) and Enable the "Disable gesture requirement for media playback" option (which is actually the same as the above URL specified).

MediaStore.Audio.Media.RECORD_SOUND_ACTION not working in nougat

I am using MediaStore.Audio.Media.RECORD_SOUND_ACTION to open sound recorder application, I am not able to open application as no default application present, then i install two voice recorder application even though not able to see these application in my chooser intent. I am using following code-
Intent soundRecorderIntent = new Intent(); // create intent
soundRecorderIntent.setAction(MediaStore.Audio.Media.RECORD_SOUND_ACTION); // set action
startActivityForResult(soundRecorderIntent, ACTIVITY_RECORD_SOUND); // start activity
It works well in marshmallow
The code is correct and you've probably found an app that supports the intent by now. But to prevent that others waste their time like I did, here's a quick note:
Most of the currently top rated voice recording apps in the Play Store do not provide the necessary intent filter.
That seemed so unrealistic to me that I doubted my code when it didn't work after having installed the five most popular voice recording apps. But there's a handy manifest viewer app that reveals that their manifests simply do not declare the intent filter. So, as said, the code is correct.
To save you the time from searching for a suitable app, here are two that are invocable:
Audio Recorder from Sony
Samsung Voice Recorder from Samsung
There is no requirement for a voice recorder app to support this Intent action, and apparently your device does not ship with an app that supports this Intent action either. Your code itself seems fine.
If recording is optional to your app, catch the ActivityNotFoundException and tell the user that they do not have a recorder, and perhaps suggest to them that they install one that you test that works, if you can find one.
Otherwise, record the audio yourself, using MediaRecorder.

video set to "true" in Skype video chat URI, but video is not enabled when call starts

I'm using the Skype API from their site: skype apir/uri for video call
which saiys the following URI "Calls other people on Skype, and automatically turns on the call originator’s video":
skype:skypeUserName?call&video=true
when I start the intent, it places the call successfully, but the video is NOT enabled, on either phone by default.
One suspicion I have is maybe everything after the question mark is getting stripped.
this is how I pass it in:
static String skypeURI = "skype:stablesentryremote?call&video=true";
public void initiateSkypeUri(Context myContext, String mySkypeUri) {
// Create the Intent from our Skype URI
Uri skypeUri = Uri.parse(mySkypeUri);
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);
}
But this could just be a skype bug.
[update] I read somewhere that this is a bug that started in the latest release of skype. So at this point I am looking for a work around.
I see you've figured out that there seems to be a problem with video call in the newest versions of Skype for android and ios. Maybe the new apps treat video calls as a conference call even if it's a 1 to 1 call (which isn't supported as stated in the skype api/uri doc), I suggest you report this problem to MS through for example appstore (not sure if there's similar possibility to do so in google play?) and mention the same bug happens on android.
If you need something to work ASAP while waiting for MS to fix the bug I'll suggest a solution but it might not be worth the time you'll need to spend in order for a working implementation. But I'll leave that up to you to consider.
What you could do is send an message (or just do a regular call) to the remote sentry with an unique message ie: "videocall:requested timestamp here"
And then have a Autohotkey script running at a X seconds interval on your remote sentry, looking for the unique message above from point 1.
If the message is retrieved and identified as valid, then initiate a video call from your sentry towards the user.
There's some good skype functions here that might help you get started:
http://www.autohotkey.com/board/topic/96375-skype-functions/
I ended up implementing my own video call using the OpenTok libraries:
http://tokbox.com/opentok
after 2 days of research, I found their library to be the easiest to use. Once I downloded their example project, I had video call working in 30 minutes. Its free for 1on1 calls, and they charge bu the minute for conference calls. perfect for my case.

Launching Android Market Main Page from an application

I'm trying to write a launcher-like application (I'm not planning to release it, it's just for me to use) but I don't seem to find any way to launch the Market.
All of the answers I've found actually perform a search on the Market (using a uri "market://") or even worse they run the Market on a specific app page, while I'm trying to show the main page of the Market, i.e. the page shown when you run it from the launcher.
I tried using just "market://" as a Uri, without query strings, but it doesn't work; I also tried to get exactly the same "signature" of the "start activity command" that appears in the LogCat when I run the Market from the Launcher (by manually editing component, flags and categories), but it still doesn't work.
Is there any way to get it to show the main page?
Thanks in anticipation.
Intent intent = new Intent();
intent.setClassName("com.android.vending", "com.android.vending.AssetBrowserActivity");
startActivity(intent);

Send music control keys from my app in android

Is there a simple way to tell the default media player to change track back or forward?
I want the ability to send commands to the system media player (Music) to change track back and forward from within my app.
Is there a simple way? Code examples or descriptive explanation please, I have not developed for Android before.
Update: Is it just the HTC Music that isn't part of the SDK or even the stock one? Either player would be fine if I could manage way to change tracks.
The HTC Lock screen has some method of changing tracks in the music player. Is it possible I could get hold of this and use it?
Baksmali?
I want the ability to send commands to
the system media player (Music) to
change track back and forward from
within my app.
The Music application is not part of the Android SDK, so there are no documented and supported Intents for moving from track to track.
Sorry!
by ACTION_MEDIA_BUTTON using intent ??
http://developer.android.com/reference/android/content/Intent.html#ACTION_MEDIA_BUTTON
Intent media_intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
media_intent.setPackage(DEFAULTPLAYER);
synchronized (this) {
media_intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, keycode));
mContext.sendOrderedBroadcast(media_intent, null);
media_intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, keycode));
mContext.sendOrderedBroadcast(media_intent, null);
}
however DEFAULTPLAYER needs to be assigned...
:S :S :S

Categories

Resources