Play Spotify Preview in Flutter - flutter

I wanna play spotify track's preview in my app(Like instagram story music section). Its simple Spotify preview example url
But when I try just_audio or audioassets plugin
I get error like this.
codec does not support config priority (err -2147483648)
How can I play spotify preview mp3 in my app?

Do it Hope this will help you ,
#override
void dispose() {
super.dispose();
controller.dispose();
}

Related

Opening Google calendar from Flutter app (Deep Linking)

I want to open Google calendar app more specifically the create event page in the app from my another flutter app.
I am using the URL launcher package but it opens the app in chrome
What change should I make in the URL so that the add event page opens directly in the google calendar app.
Currently my URL looks like below
https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210226T033000/20210226T040000&ctz=Asia/Calcutta&location&text=Blawsome:+A+Crystal+Alchemy+Healing+Meditation&details=Parth+Pitroda
My code for that part is as below
if (await canLaunchUrl(Uri.parse('https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210226T033000/20210226T040000&ctz=Asia/Calcutta&location&text=Blawsome:+A+Crystal+Alchemy+Healing+Meditation&details=Parth+Pitroda'))) {
await launchUrl(
Uri.parse('https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210226T033000/20210226T040000&ctz=Asia/Calcutta&location&text=Blawsome:+A+Crystal+Alchemy+Healing+Meditation&details=Parth+Pitroda'),
mode: LaunchMode.externalApplication);
} else {
throw 'Could not launch URL';
}
rathe than using a HTTP request, you could use googleapis package from https://pub.dev which has inbuilt methods to create Google Calender events directly within the Calender app.
Check package and documentation here.
Happy coding!

How to play DRM content in flutter web version?

Flutter application is implemented for both mobile and web versions. We have a player to stream DRM content. And for android native by using ExoPlayer support we are able to play the DRM content. Below is some package used for providing the license for player.
com.google.android.exoplayer2.source.dash.DashMediaSource
com.google.android.exoplayer2.drm.DrmSessionManager
com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource
com.google.android.exoplayer2.source.ProgressiveMediaSource
com.google.android.exoplayer2.source.hls.HlsMediaSource
Now we would like to play the same DRM content with web version. We are using 'VideoElement' to play the stream url. VideoElement is working fine for normal video url's but we are not finding the way to play DRM content in it. In other way, we are not able to provide license URL in VideoElement of web version to play DRM content.
Present web video player code is mentioned below.
videoElement = VideoElement()
..src = uri
..autoplay = false
..controls = false
..style.border = 'none';
videoElement.setAttribute('playsinline', 'true');
ui.platformViewRegistry.registerViewFactory(
'videoPlayer-$textureId', (int viewId) => videoElement);
Any suggestions to add license url/ play the DRM url.

How to show Oauth Consent screen in flutter

I am trying to user gmail api. Google is asking me to make a video with demo of Oauth consent screen.
While searching in the internet I have found solutions for web and native android android. The docs of flutter packages googleapi and googleapi_auth were not very helful. If anyone has already implemented any suggestions would be helpful.
It's probably too late but here is the code for
' clientViaUserConsent(_clientid, _scopes, userPrompt)
.then((AuthClient client) {
//your code to authenticate any of your google platform
}
Here is the userPrompt function
void userPrompt(String url) async {
if (await canLaunch(url)) {
print("Launching url");
launch(url);
} else {
print("unable to launch the url");
}}
So whenever the clientviauserprompt is called the prompt function will launch the url to the default browser for the user consent.
You have to use urllauncher dependency for this.

Stream a movie on Netflix on LG Smart TV

I am trying to stream a movie on Netflix on LG Smart TV using the connect SDK. I know that I can start the YouTube app using the ConnectSDK, but can someone help me understand how I can use ConnectSDK to play a particular video on netflix on my LG Smart TV given the video ID?
Thanks!
The answer you are looking for can be found in the Android API Sampler for Connect SDK. Here is a snippet that may help you out.
device.getLauncher().launchNetflix("<< NETFLIX CONTENT ID >>", new Launcher.AppLaunchListener() {
#Override
public void onSuccess(LaunchSession session) {
setRunningAppInfo(session);
}
#Override
public void onError(ServiceCommandError error) { }
});

Creating a docked music player for SoundCloud and mp3s

I'm trying to create a website that pulls free songs from multiple sources and lets users play them by clicking on their cover art, and launching them in a docked music player on the bottom of the page. Soundcloud's api offers me a lot of songs, but they are in a streaming api format, not in mp3 form.
The music players that SoundCloud offers are great for these streaming songs, but it won't work with the mp3s I'm pulling from other sites. Mp3 players like Jplayer are great for the mp3s, but I can't figure out how to get it to work with the streaming soundcloud format.
Think of a site like ex.fm: http://ex.fm/search/bob%20dylan
They pull their audio tracks from many sources but it is all playable through their one player.
Any help with this would be great.
Thanks
Check SoundCloud API
http://developers.soundcloud.com/docs/api/reference#tracks
There is a stream_url property for every track that's streamable outside of SoundCloud.
You need to register your app on Soundcloud and get API Key. With that key you can stream the tracks in your own player.
Edit, thanks to gryzzly. Example of SoundCloud API used with jPlayer:
var SOUNDCLOUD_API = 'http://api.soundcloud.com',
CLIENT_ID = '?client_id=REPLACE_WITH_YOUR_CLIENT_ID';
$(document).ready(function() {
var apiRequest;
$.get(SOUNDCLOUD_API + '/tracks/6981096.json' + CLIENT_ID)
.done(handleRepsonse);
function handleResponse (soundData) {
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
// stream_url is good enough for jPlayer,
mp3: soundData.stream_url + CLIENT_ID
});
},
swfPath: "http://www.jplayer.org/2.1.0/js"
});
}
});
And you can check it live at jsbin.com/ajaken/4/edit