I'm trying to embed Reddit videos with sound from a url. So far I've figured out that you can get the a soundless video by doing:
Link is https://www.reddit.com/r/aww/comments/jien07/living_the_good_life/
Go to https://www.reddit.com/r/aww/comments/jien07/living_the_good_life.json
Find fallback_url, in this case it's https://v.redd.it/4ymh7g5fzfv51/DASH_720.mp4
The issue is that that video doesn't have any sound, how can I get it with sound? I've tried doing share->embed, but the code it gives me doesn't work when I put it into a page. It also has more information than I need, I just need the video.
Yes, there were some bugs with reddit embed video for a while, the console shows the error is Uncaught TypeError: Cannot read property 'getItem' of null, it's because the iframe script can not access the localStorage, localStorage will be null, but reddit does not handle null case:
RedditVideoPlayer.prototype._prepareLocalStorage = function() {
if (typeof localStorage != "undefined") {
var e = localStorage.getItem(this.storageNamespace + ".volume") || this.options.volume
, t = localStorage.getItem(this.storageNamespace + ".muted") || this.options.muted;
this._lastVolume = parseFloat(e),
t.toString().toLowerCase() == "true" ? this.mute() : this.unmute()
}
}
There are also some posts on Reddit like point the problem: https://www.reddit.com/r/bugs/comments/jhx80w/embed_imagevideo_code_is_broken/, but there is no response by the official.
I also found that the iframe works on the mobile, because they don't enable the localStorage at the mobile device.
For PC now, you can use the reddit dash url instead of a cross origin proxy in your site.
I found where to get the video with sound. Although this is an old question, some may still stumble upon it.
you should to take it out
secure_media.reddit_video.hls_url
If you insert this url in the browser, it will download. But if in the player, then everything will be ok! video with sound
Related
I've created an app in React Native which allows a user to search for songs, which uses the Apple Music API. So far, so good.
For the next step. What I want to do is use the songs the user has searched for, and let them save them as a playlist in their Apple Music account (assuming they are a subscriber, etc.).
However, there seems to be a lack of documentation and examples on how to do this (at least compared to Spotify - I'm recreating a Spotify App I made in the past).
I'll need to get authorisation from the user, and then use this endpoint: https://developer.apple.com/documentation/applemusicapi/create_a_new_library_playlist, but I can't find out how exactly to do this. Other parts of the API documentation seem to simply state "With proper authorization from the user, you can also create or modify playlists and apply ratings to the user's content." but never actually explain or link to how to get this authorization.
Can anyone point me in the right direction? And let me know if what I'm trying to do is actually possible with Apple Music - it seems like it is, but the way I'm going around in circles, I'm not so sure anymore. Thank you
I don't know if this will help or not (I'm an iOS dev, not a React dev), but here's the call to save a playlist to a user's Music library, in Swift. Maybe it'll help point you in the right direction(?)
If you'd rather not have Swift code polluting your thread, let me know and I'll remove it.
import StoreKit
// ...
// request user token
if let devToken = UserDefaults.standard.string(forKey: "devToken") {
SKCloudServiceController().requestUserToken(forDeveloperToken: devToken, completionHandler: { userToken, _ in
guard let _ = userToken else { return }
self.addPlaylist()
})
}
// add playlist
func addPlaylist() {
MPMediaLibrary.default().addItem(withProductID: "pl.u-065LACYzL34", completionHandler: { _, error in
guard error == nil else {
print("add playlist sad")
return
}
// success
})
}
I've been looking at trying to do this for a while now.
MusicKit JS works in the browser, but since there is no browser in iOS, that's a no-go: there is no Window.musicKit.getInstance(). And I've yet to find any other way to authorize MusicKit, using JavaScript, except for MusicKit JS.
You can access the Apple music Catalog via the API with only a developer token. You can even access (read only) a user's playlist, if it's public and you know the global id, but that's not what we're after here. We want access to a user's Library so that we can do stuff (except delete, because you can't delete stuff through the Apple Music API).
To authorize access to a user's Library in iOS, you need to use StoreKit, per this, and in order to do that with React Native, you need to use Native Modules per this.
The problem about that second bit, is that I got no idea how to do this. I've read a few things, but I'm not connecting the dot's yet.
If you (or anyone) has figured this out, dropping a note with a how-to here would be awesome. If I do figure it out, I'll come back here and post.
Update: I found this article, which comes close to explaining it really well.
The issues I'm having here are that in the Add a React Native iOS Project section, there's an unfinished sentence ("Here we create..."), and I can't seem to find React.xcodeproj when I run through the steps the author has provided.
Additional remarks: you can run Javascript on a Page in Shortcuts but only when you run shortcuts from sharesheet from Safari.
Also, contrary to what you may seen in many tutorials keep in mind that for POST requests a header Music-User-Token has a value without word "Bearer". In GET request using "Bearer" word will also work. I've built webpage to get music-user-token to clipboard and save it to use it in Shortcuts.
I am generating a branch.io deeplink in my react native app using the below code
let branchUniversalObject = await branch.createBranchUniversalObject(
canonicalIdentifier,
{
locallyIndex: true,
title,
contentImageUrl,
contentDescription: contentDescription || '',
contentMetadata: {
customMetadata,
},
}
)
It gives me a link something like https://xyz.abc.com/OrzOISGRP0
I have kept my localhost for desktop url in branch.io settings.
Now my question is, is there a way i can get the customMetadata associated with this deeplink in the website?
I tried using branch.init() web sdk, but its not returning the required data if i open the link directly, it redirects me though and also appends branch_match_id.
It sends the data in listener registered on site if someone have clicked the link and opened it on phone, i dont know whats the use of that.
Thanks
I'm running a VueJS application that displays a full screen story of videos. I don't create as many tag as number of media in my story : I'm just changing component video sources each time I play a new video.
But it looks like Safari (Desktop & mobile) still does not cache HTML video once loaded : when I'm playing again a previous media, Safari is downloading again the asset. Instead of getting from cache like Chrome does.
The same issue has already been reported here but sill no correct answer.
Safari even stops downloading the final bytes video (producing a sort of timeout) when we go back and forth quicky in the story, so the story looks stuck.
Here's an example link.
Does anyone know a good alternative that avoids re-downloading video data at each play on Safari ?
Partial solution
Found myself a workaround that works pretty well if video is small size - all video are less than 3Mb in my case.
The trick is to use js fetch API to download full video, then stream it into video tag.
const videoRequest = fetch("/path/to/video.mp4")
.then(response => response.blob());
videoRequest.then(blob => {
video.src = window.URL.createObjectURL(blob);
});
Contrary to video src attribute, fetch API will get video data from cache if the same video was already fetched before.
Here a codepen demo that can be tested in Safari desktop/mobile (when NOT in private mode).
Pro : Video are now pulled from cache in Safari !
Con : You can't start the video until full data has been downloaded. That's why this solution can be used only for small video (like < 5Mb), else your users may wait a while before being able to play the video.
I have developed one application. I have to upload video on fb timeline, from developed application trough Facebook JavaScript sdk with help of FB.ui method.
i have shared part of my code, which i tried to post video on facebook timeline.when i used this code, video get upload as a link. it will navigate to new tab and play when i click on that link.(my video type is mp4.)
FB.ui({
method: 'feed',
display: 'popup',
type:'mp4',
source:filePath,
picture:filePath,
},function (response) {
if (response && !response.error_message) {
alert('Posting completed.');
} else {
alert('Error while posting.');
}
I expect the video to be play on my timeline instead of posting as a link.
I expect the video to be play on my timeline instead of posting as a link.
That expectation is simply unfounded – this isn’t supposed to work this way, and never has.
You would need to share a link to an HTML document, that has the video embedded via Open Graph meta tags, see https://developers.facebook.com/docs/sharing/webmasters#video
But Facebook has begun limiting the occasions on which they actually play such videos inline; so even if you implement this properly and technically correct, there is no guarantee any more it will play in news feed; users clicking on such a post might simply get redirected to your external site to play the video there.
Hi I am using opentok.
When I say
publisher = OT.initPublisher();
session.publish(publisher);
My own video is visible to myself. I want to see only other participants video but not my own. I want my video to be visible to everyone else in the session except me.
How to make this possible.
And can I make other people video to full-screen?
Please help...
You can try this...
var publisher = OT.initPublisher('myPublisherDiv', {display: 'none'});
session.publish(publisher);
Or you can explicitly check on the video using firebug or chrome dev tool and see if it has an existing class or id, then you can just add in a display none on the class ex.
.video-class{
display:none
}