How to map a list of videogular2 videos - ionic-framework

Based using ionic v.3 to build app. Here is the question:
I have a bulk list of video urls and each time fetch 10 to show on the page.
<vg-player>
<vg-overlay-play></vg-overlay-play>
<video #media1 [vgMedia]="media1" src="{{videourl1}}"></video>
</vg-player>
<vg-player>
<vg-overlay-play></vg-overlay-play>
<video #media2 [vgMedia]="media2" src="{{videourl2}}"></video>
</vg-player>
when in mapping, I can use [vgMedia]="{{video_id}}" to replace, but how about "#media1"?

Related

Put facebook avatar url into img[src] doesn't work in Ionic 3

In sample, have two avatar URLs, one of them doesn't show up in ionic app and just do download in browser, instead to open in tab.
So if put this url that doesn't work(1) into [src] attribute, image is not loaded in ionic emulator and in real device, but everything is OK in Chrome.
https://graph.facebook.com/105656846898488/picture?width=200&height=200&redirect=false&type=normal
https://graph.facebook.com/67563683055/picture?width=200&height=200&redirect=false&type=normal
ex. of usage:
<img [src]="user.avatar">
Parse method:
let x = new XMLHttpRequest();
x.open("GET", `https://graph.facebook.com/${facebookUserId}/picture?width=200&height=200&redirect=false`, false);
x.send(null);
return JSON.parse(x.responseText).data.url;
I guess something with facebook server setting, because both images pulled from different server domains.
Image with facebook userid: 67563683055 - work's good.

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.

Retrieve Dailymotion Games chat messages

I would like to retrieve Dailymotion Games chat messages using their API, but the official documentation is not very clear on this point => https://faq.dailymotion.com/hc/en-us/articles/203886473-Dailymotion-live-API-for-developers
I tried to use the API to retrieve comments of a video with my live video id (endpoint => https://api.dailymotion.com/video/[LIVE_VIDEO_ID]/comments), but it doesn't return any chat messages...
Do you know if it's possible?
Ok, I've searched a little bit more and I found a more elegant way to do that avoiding the scraping method.
In fact the embed chat page (returned by the chat_embed_url) use EventSource to get notified when a new message arrived.
With this good NPM package, I've been able to retrieve chat messages in only 5 lines:
var EventSource = require('eventsource');
var url = 'http://dmchat.dailymotion.com/rooms/[USERNAME]-[CHANNEL_ID]';
var es = new EventSource(url);
es.addEventListener('message', function (e) {
console.log(e.data);
});
A comment on a video is different from the chat feature, this is why chat messages don't appear in comments.
You can't get individual chat messages so far, but you can get the chat embed code on two different ways:
using the Dailymotion API, you can request the chat_embed_html or chat_embed_url fields on the video object
or you can get it directly from the video pages on dailymotion games, by clicking on the settings icon below the chat, and click "copy embed code"

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