Sending headers along with flutter network video - flutter

I am developing a video player app for windows using flutter windows.
I want to play a network video and send headers along with the video request
I am using dart_vlc package to do so.
I am setting extras property to send the headers but I doesn't work
Player player = Player(id: 1000);
player.open(
Media.network(
'http://localhost:3000/streamVideo',
extras: {
'videoPath':'this is the video path'
}
),
);

Related

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.

Can't play some Vimeo videos. Is it possible to set Referer request header on ionic

I have both an Web application and a Mobile (Ionic) application that has this feature to play Vimeo videos uploaded by the user to the Vimeo account configured in the environment.
So in the web application, I'm able to play the video in the component mounting a simple player.vimeo url this way:
function getUrlVimeo(videoid) {
return $sce.trustAsResourceUrl("//player.vimeo.com/video/" + videoid);
}
And so the api request looks like that:
Vimeo API request to play video (web-side) (internal redirect)
Vimeo API request to play video (web-side)
Note the Referer request header: the url that's sent on this header is the web application url.
But I've noticed I can't play the same video on Mobile (Ionic) application probably because of the Referer request header, that is sent correctly when on web application because the browser does it automatically, but the same doesn't happen on Ionic 3 Mobile application.
Code sample inside ngOnInit() method on the page that reproduces the video on Mobile application, this.href is set as the video id for the Vimeo Video component:
console.log('video-link-player-vimeo page .... ngOnInit()');
if(this.isCourse) {
this.href = this.conteudoVideoDetail.data.href;
} else {
this.href = this.trailContent.data.href;
}
var options01 = {
id: this.href
};
this.Vimeo = window['Vimeo'];
this.player = new window['Vimeo'].Player('player_vimeo', options01);
But this causes the following privacy error:
Privacy error on ionic mobile
The API request on Mobile looks like that:
Vimeo API request to play video (mobile - ionic)
I believe if I could set the Referer request header to the the environment url (same as web), it would work, but Ionic automatically sets it to http://localhost/ and I can't seem to find a way to change it.
Is there any way I can do that or overcome this privacy setting error in any way?

Facebook Graph API: cannot playback live video stream (rtmps)

I'm trying to playback a live video that is streamed using the Facebook app. When I hit the /me/live_videos endpoint in the Graph API Explorer, I can see my stream:
{
"status": "LIVE",
"stream_url": "rtmps://rtmp.facebook.com:443/rtmp/1659765194096063?ds=1&s_efg=eyJxZV9ncm91cHMiOnsiZmJsaXZlX3NlcnZlcl9leHBlcmltZW50Ijp7InNlcnZpY2VfcG9ydCI6IjE3MDAwIn19fQ%3D%3D&a=ATiAO7IBgkxJpDTS",
"secure_stream_url": "rtmps://rtmp.facebook.com:443/rtmp/1659765194096063?ds=1&s_efg=eyJxZV9ncm91cHMiOnsiZmJsaXZlX3NlcnZlcl9leHBlcmltZW50Ijp7InNlcnZpY2VfcG9ydCI6IjE3MDAwIn19fQ%3D%3D&a=ATiAO7IBgkxJpDTS",
"embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fjonathan.apphus%2Fvideos%2F1659765184096064%2F&width=360\" width=\"360\" height=\"640\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" allowFullScreen=\"true\"></iframe>",
"id": "1659765194096063"
}
The stream is set to public, so anyone from within or outside of Facebook should be able to view it. My problem is that I am not able to view the stream using the "stream_url" (or "secure_stream_url"). I am trying to view it using VLC (have tried both the desktop app and the VLCKit lib on iOS).
Btw, the https link from the iframe works. I am able to view the stream in the browser using this link.
The stream_url returned is only for forwarding the encoded video stream, not for receiving.
If you want to view the live video, use dash_preview_url field of the live video.
You can use graph api to get this url by sending a GET request at this end point:
/LIVE_ID?fields=dash_preview_url&access_token=YourAccessToken
This will return a url which can be played using any Dash Player.
As far as I know, VLC currently does not have support for MPEG-DASH.

Tizen Samsung SDK: How do you play HLS video?

http://www.samsungdforum.com/TizenGuide/?FolderName=tizen61&FileName=index.html#/TizenGuide/?Foldername=tizen61&Filename=index.html
The above says:
You have two options for multimedia player in Tizen application.
■Use HTML5 tag. It doesn’t support DRMs and streaming engines like DASH, HAS, HLS and SmoothStreaming.
■Use avplay API or Samsung TV
product API. It supports DRMs and streaming engines like DASH, HAS,
HLS and SmoothStreaming.
Is this true? They say it's a private SDK, is that why I can't see any references to it online? And do we need the private sdk to stream HLS at all, or is it only for fancy player stuff?
HTML5 video tag does not supports HLS on Tizen platform.
You need to use AVPlay API to play streaming or DRM content.
Try to test AVPlay (Video Play) Sample in your emulator.
config.xml must content:
<access origin="*" subdomains="true"/>
<tizen:privilege name="http://tizen.org/privilege/internet"/>
in head html file include:
JS:
var init = function () {
console.log('init() called');
var videos = document.querySelector('video');
videos[0].play();
};
window.onload = init;
HTML:
<body>
<video src="file.m3u8" controls></video>
</body>
See also this example: https://github.com/SamsungDForum/PlayerHTML5

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