投稿時間:2022-12-31 02:18:41 RSSフィード2022-12-31 02:00 分まとめ(23件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita 【AtCoder】ABC254 のA,B,C,D,E における Python解説 https://qiita.com/Waaaa1471/items/037959cf9109c9420429 abcde 2022-12-31 01:32:21
python Pythonタグが付けられた新着投稿 - Qiita [python][pandas] Series, DataFrameの統計量を得る https://qiita.com/yossy_stu/items/87b39933d8399a169533 dataframe 2022-12-31 01:15:04
海外TECH MakeUseOf 6 Ways to Free Up Storage Space in Windows 11 https://www.makeuseof.com/windows-11-free-up-storage-space/ windows 2022-12-30 16:16:15
海外TECH DEV Community We’ve moved to Fosstodon 🦣 https://dev.to/devteam/weve-moved-to-fosstodon-53e1 We ve moved to Fosstodon 🦣Back in November the DEV Team announced that we had begun exploring the Fediverse DEVCommunity Now available via Toot 🦣 Erin Bensinger for The DEV Team・Nov ・ min read socialmedia meta mastodon fediverse With the caveat that…We look forward to expanding our presence into new and exciting servers in the future ーfor now this is our home for toots The time for that expansion has come Beginning today we ll be Tooting from ThePracticalDev Fosstodon org Because this is such a novel and exciting time in the social media sphere and we here at DEV are particularly interested in the independent web as well as the potential of open source software we wanted to let you in on how and why this decision was made We started on Mastodon Social for a few reasons ben had already made us an account there back in Thanks Ben At the time it was the fastest growing and best known Mastodon server It was a topic neutral place to start as we observed the growth of the wider Fediverse We knew that we d have the opportunity to switch servers fairly easily and at any time Here s why we chose Fosstodon org as our new landing spot Our OSS roots run deep We re eager to contribute to the conversation in a space that s oriented around open source and its potential At k active users at the time of this posting Fosstodon is a large server but still much smaller than Mastodon Social k active users We re hopeful that being part of a smaller more focused community will help us reach our community members more effectively Fosstodon is primarily an Anglophone server and our social accounts are run in English We re still cross posting our Twitter feed to Mastodon using moa party for now We recommend checking it out if you re looking for a simple solution to expand your presence across platforms Ok your turn how did you decide where to make your home in the Fediverse Have you considered moving 2022-12-30 16:39:34
海外TECH DEV Community How we build a-la Google Meet with NextJS, PeerJS and SocketIO https://dev.to/olzh2102/how-we-build-a-la-google-meet-with-nextjs-peerjs-and-socketio-4n48 How we build a la Google Meet with NextJS PeerJS and SocketIOHi there  We are two friends are going to explain how our journey into the world of WebRTC and WebSockets was We had a lot of struggles disappointment and also fun We hope this post will be helpful or at least informative for whoever is reading We both are frontend engineers hence to build the app we went for well known NextJS as our core framework  For styling we chose TailwindCSS since we haven t had any experience with it and we wanted to play around with it  After reading a couple articles and watching some tutorial videos we realised that dealing with WebRTC natively is quite cumbersome Due to this PeerJS came handy to abstract away some configurations around WebRTC While implementing peer to peer communication there must be a signalling server for the purpose of keeping in sync the state s muted camera is off and etc between peers Therefore SocketIO played a role of signalling server Basic authentication layer was integrated via Auth to implement certain features In this article we are going to develop following features lobby page to setup your initial stream settingscreation of a room to joinmeeting host abilitiessharing screen with othersturning off light indicator of your device if video stream is offvisual indication of active speaker in the roommessaginglist of participants and their statusesExcited Let s dive into it Initial setupinstallation and configuration of TailwindCSS   Pull Request documentationinstallation and documentation of Auth   Pull Request documentationintegration of SocketIO with NextJS   Pull RequestBefore diving into explanation of features implementation details we would like to give you a visual representation of the folders structure It would help to navigate while reading app index tsx components lobby tsx control panel tsx chat tsx status tsx contexts users connection tsx users settings tsx hooks use is audio active ts use media stream ts use peer ts use screen ts pages index tsx room roomId tsx Lobby PageOnce the user has landed on home page they have two options create a new room or join an existing one No matter what is selected they are going to go through the lobby page to setup their initial stream setting such as muting their mic or turning their video off before entering pages roomId tsxexport default function Room NextPage const isLobby setIsLobby useState true const stream useMediaStream return isLobby lt Lobby stream stream onJoinRoom gt setIsLobby false gt lt Room stream stream gt As you noticed now we have a stream Stream can be audio and or video and it is a chain of data in time period Protocol MediaCapture and Streams API allows us to create and manipulate the stream The stream itself consist of multiple tracks mainly audio and video Here is Lobby component components lobby tsx pseudocodeconst Lobby stream onJoinRoom stream MediaStream onJoinRoom gt void gt const toggleAudio toggleVideo useMediaStream stream return lt gt lt video srcObject stream gt lt button onClick toggleVideo gt Toggle video lt button gt lt button onClick toggleAudio gt Toggle audio lt button gt lt button onClick onJoinRoom gt Join lt button gt lt gt Note from MDN The enabled property on the  MediaStreamTrack  interface is a Boolean value which is true if the track is allowed to render the source stream or false if it is not This can be used to intentionally mute a track When enabled a track s data is output from the source to the destination otherwise empty frames are output With that said toggling enabled property does not require any syncing process between peers as it happens automatically Going inside the roomTo make our life easier let s imagine the user went with audio and video on Right after entering the room Peer and Socket entities are created Peer to connect and share a stream with other users and Socket to transport a state of stream To create a peer we are going to need roomId from useRouter and user from useUser hooks use peer ts core part of the code open connectionpeer on open id PeerId gt tell others new user joined the room socket emit room join roomId which room to connect to user id name user name muted visible joining user s data Below you can find pseudo code realisation of Room page component app index tsx pseudocode stream comes from Lobby pageexport default App stream stream MediaStream gt const socket useContext SocketContext const peer usePeer stream return lt UsersStateContext Provider gt lt UsersConnectionContext Provider value peer stream gt lt MyStream gt lt OthersStream gt lt ControlPanel gt lt UsersConnectionContext Provider gt lt UsersStateContext Provider gt UsersStateContext takes responsibility for changing and translating the state of user UsersConnectionContext is all about communication entering a room setting up a connection between peers leaving a room and demonstration of screen Yeap screen demonstration is part of communication because of newly created stream for sharing user s screen We will talk about it in more detail bit later So we are inside the room Now all the other users that have been here already have to greed themselves give their stream and name to display contexts users connection tsx event is listened on users who are already in the roomsocket on user joined id name UserConfig gt call to newly joined user s id with my stream and my name const call peer call id stream metadata username user name In here our socket basically says Yoyo here we have new guest in da house via event name user joined and after it is triggered every single user comes to new guest to welcome them with stream and name And in response they take name stream and id of the guest contexts users connection tsx action below happens on the newly joined user s devicepeer on call call gt const peer metadata call const user metadata answers incoming call with the stream call answer stream stream name and id of user who was already in the room call on stream stream gt appendVideoStream id peer name user name stream Success We have established connection between peers and now they can see and hear each other Panel of control buttonsAll good but at this point no one can manipulate their stream So it is a time to dig into what can be changed for a given stream toggle audiotoggle videoshut downshare display app index tsx lt ControlPanel visible visible muted muted onLeave gt router push onToggle onToggle gt There is nothing special about leaving the room where we just redirect to home page and our return function inside useEffect takes care of cleaning up with destroying connection However interesting bit comes to onToggle method app index tsx only related part of the codeconst toggleAudio toggleVideo useMediaStream stream const myId usePeer stream const startShare stopShare screenTrack useScreen stream async function onToggle kind Kind users MediaConnection switch kind case audio toggleAudio socket emit user toggle audio myId return case video toggleVideo newVideoTrack MediaTrack gt users forEach user gt replaceTrack user newVideoTrack socket emit user toggle video myId return case screen if screenTrack stopShare screenTrack socket emit user stop share screen else await startShare gt socket emit user share screen gt socket emit user stop share screen return default break toggleAudio and toggleVideo functions are acting in a similar way but with a tiny difference in toggleVideo that will be described further below Screen sharing hooks use screen tsasync function startShare onstarted gt void onended gt void const screenStream await navigator mediaDevices getDisplayMedia video true audio false const screenTrack screenStream getTracks setScreenTrack screenTrack stream addTrack screenTrack onstarted once screen is shared tiny popup will appear with two buttons Stop sharing Hide they are NOT custom and come as they are so onended is triggered when user clicks Stop sharing screenTrack onended gt stopShare screenTrack onended To start sharing the screen we would need to create new stream take out its video track and extend our current stream with it Eventually we are going to have three tracks audio webcam track and screen track Next we notify other users with event user shared screen so they can reset peer connection to receive additional video track contexts users connection tsxsocket on user shared screen gt peer connection reset peer disconnect peer reconnect To stop sharing we would need to stop the video track and remove it hooks use screen tsfunction stopShare screenTrack MediaStreamTrack screenTrack stop stream removeTrack screenTrack Control actions of host userThe host user has permission to mute and disconnect other users Those actions are visible once the user hovers over the video stream components video container index tsx pseudocode wrapper around the stream takes a responsibility to render corresponding component or icon depending on the state of streamfunction VideoContainer children id onMutePeer onRemovePeer children React ReactNode id PeerId onMutePeer id PeerId gt void onRemovePeer id PeerId gt void return lt gt lt div gt here goes video stream component children lt div gt show host control panel if I created the room isHost amp amp myId id amp amp lt HostControlPanel onMutePeer gt onMutePeer amp amp onMutePeer id onRemovePeer gt onRemovePeer amp amp onRemovePeer id isMuted muted gt lt gt To mute some other user is trivial since MediaStreamTrack API handles that for us but in order to visually represent that the host has muted someone we are triggering socket event with payload of the muted user s id However there are multiple actions that get called once onRemovePeer is executed send others removing peer s id so they can show respective icon or toasterremove the user from “my room and update the state of streamsclose peer connection contexts users connection tsxfunction leaveRoom id PeerId notify everyone socket emit user leave id closing a peer connection users id close remove the user in ui setStreams streams gt const copy streams delete copy id return copy Turning off web cam light indicatorHere comes the tiny difference between toggleAudio and toggleVideo While we are turning the video stream off we have to make sure that the indicator light goes off That guarantees that the web camera is currently switched off hooks use media stream ts param onTurnVideoOn optional callback that takes newly created video trackasync function toggleVideo onTurnVideoOn track MediaTrack gt void const videoTrack stream getVideoTracks if videoTrack readyState live videoTrack enabled false videoTrack stop turns off web cam light indicator else const newStream await navigator mediaDevices getUserMedia video true audio false const newVideoTrack newStream getVideoTracks if typeof onTurnVideoOn function onTurnVideoOn newVideoTrack stream removeTrack videoTrack stream addTrack newVideoTrack setStream stream The false value of property enabled does not know anything about the indicator light hence it does not turn it off There is a method called stop on the interface of MediaStreamTrack which tells your browser that the stopping track is not anymore needed and changes readyState to ended Unfortunately MediaTrack does not have a start or restart method as you may have thought of Therefore to turn the camera on we create a new stream take the video track from it and insert it into the old stream Wait we are changing video track back and forth here without notifying other users in the room Relax replaceTrack got your back app index tsx param track new track to replace old trackfunction replaceTrack track MediaStreamTrack return peer MediaConnection gt const sender peer peerConnection getSenders find s gt s track kind track kind sender replaceTrack track Consider our web cam is off Now what happens when we turn it back on An optional callback is passed inside toggleVideo that takes a single parameter new video track In the body of the callback we can change our old track to the new one for each user in the room In order to achieve this we use getSenders method of RTCPeerConnection interface that returns list of RTCRtpSender RTCRtpSender   object that gives you the opportunity to manipulate mediatrack sending all other users Indicator of active speakerMaybe you have noticed in google meet when a user is speaking there is a small icon in the corner of the video container indicating that the person is currently speaking All this logic is encapsulated inside the custom hook useIsAudioActive Since we are dealing here with stream of media data and it is hard to visualise it we think of it as nodes via WebAudio API AudioContext hooks use is audio active tsconst audioContext new AudioContext const analyser new AnalyserNode audioContext fftSize source is a stream MediaStream const audioSource audioContext createMediaStreamSource source connect your audio source to output usually laptop s mic here it is analyser in terms of time domainaudioSource connect analyser Depending on passed value of FFT Fast Fourier Transform and using requestAnimationFrame we know whether a person is speaking returning boolean value on each frame More detailed explanation on FFT and AnalyzerNode hooks use is audio active ts buffer length gives us how many different frequencies we are going to be measuringconst bufferLength analyser frequencyBinCount array with length half of FFT and filled with sconst dataArray new UintArray bufferLength update function update fills up dataArray with samples for each index analyser getByteTimeDomainData dataArray const sum dataArray reduce a b gt a b if sum dataArray length gt setIsSpeaking true setTimeout gt setIsSpeaking false requestAnimationFrame update ChatThere is no magic behind the chat feature we just leverage the usage of socket events such as chat post with the payload of message and chat get to receive a new message and append it to the list components chat index tsxfunction Chat const text setText useState const messages setMessages useState lt UserMessage gt useEffect gt socket on chat get message UserMessage gt setMessages append message return lt gt lt MessagesContainer messages messages gt lt Input value text onChange e gt setText e target value onKeyDown sendMessage gt lt gt components chat index tsxfunction sendMessage e React KeyboardEvent lt HTMLInputElement gt if e key Enter amp amp text const message user username text time formatTimeHHMM Date now socket emit chat post message setMessages append message setText List of users with their statusesAs a bonus feature we implemented sidebar component to show each users status in real time components status index tsxconst Status muted visible muted boolean visible boolean gt const avatars muted visible names useContext UsersStateContext const usersIds Object keys names return lt gt usersIds map id gt lt div gt lt img src avatars id alt User image gt lt span gt names id lt span gt lt Icon variant muted id muted not muted gt lt Icon variant visible id visible not visible gt lt div gt lt gt That is it We covered core features of standard video chat application We hope you enjoyed and got some knowledge out of it ConclusionAfter finishing the app we came to know that we have just scratched the surface of WebRTC and WebSockets Nevertheless the core features are done and now we have our own playground to experiment further The source code is hereThank youP S The app is little laggish and it has some bugs that we are aware of We are going to fix them 2022-12-30 16:04:57
Apple AppleInsider - Frontpage News Apple's Mac mini with 16GB RAM, 512GB SSD is back in stock for $999 https://appleinsider.com/articles/22/12/30/apples-mac-mini-with-16gb-ram-512gb-ssd-is-back-in-stock-for-999?utm_medium=rss Apple x s Mac mini with GB RAM GB SSD is back in stock for Now in stock and ready to ship bargain hunters can save on the upgraded M Mac mini plus off AppleCare Apple s Mac mini is off This upgraded Mac mini model features Apple s M chip along with GB of memory and a GB SSD double that of the standard model It s also off with promo code APINSIDER at Apple Authorized Reseller Adorama Units are in stock and ready to ship at press time making it a great year end deal for business owners students and home users alike Read more 2022-12-30 16:49:06
Apple AppleInsider - Frontpage News Smartphone sustainability is at an all-time high, Apple in the lead https://appleinsider.com/articles/22/12/30/smartphone-sustainability-is-at-an-all-time-high-apple-in-the-lead?utm_medium=rss Smartphone sustainability is at an all time high Apple in the leadA new report shows how Apple continues to go above and beyond its direct competitors when cutting its carbon footprint Daisy Apple s recycling robotSustainability is a big deal to Apple which is why it stands head and shoulders above its competition when implementing environmental forward initiatives Read more 2022-12-30 16:03:58
Apple AppleInsider - Frontpage News Year of the Rabbit AirPods Pro on sale in China, Taiwan, Hong Kong, Macau https://appleinsider.com/articles/22/12/30/year-of-the-rabbit-airpods-pro-on-sale-in-china-taiwan-hong-kong-macau?utm_medium=rss Year of the Rabbit AirPods Pro on sale in China Taiwan Hong Kong MacauTo mark the Chinese New Year Apple is releasing a limited edition Year of the Rabbit version of the AirPods Pro in four countries in Asia Year of the Rabbit AirPods ProThe Chinese New Year takes place on January and Apple is capitalizing on the event with customized versions of its hardware The latest launch is for a limited edition release of AirPods Pro personalized for the occasion Read more 2022-12-30 16:08:17
Apple AppleInsider - Frontpage News Apple Watch can act as reliable & accurate stress indicator https://appleinsider.com/articles/22/12/29/apple-watch-can-act-as-reliable-accurate-stress-indicator?utm_medium=rss Apple Watch can act as reliable amp accurate stress indicatorThe ECG feature alongside other measurements in the Apple Watch can act a basic stress detector claims a new study Back in the then forthcoming Apple Watch Series was rumored to include features for monitoring mental health issues most specifically including anxiety Apple has not included such an anxiety or stress app as yet However a limited new study claims that the Apple Watch is already useful for predicting stress because of what else it is intended to detect Read more 2022-12-30 16:08:44
Apple AppleInsider - Frontpage News New York passes functionally toothless Right to Repair bill https://appleinsider.com/articles/22/12/29/new-york-passes-functionally-toothless-right-to-repair-bill?utm_medium=rss New York passes functionally toothless Right to Repair billNew York is the first US state to pass a Right to Repair bill but it has been watered down to effectively make it worthless for consumers Apple Repair ProgramFollowing its passage through the New York State Senate in New York has now officially passed an electronics Right to Repair bill It will concern electronic devices with certain exceptions that are sold for the first time in New York from July Read more 2022-12-30 16:09:56
Apple AppleInsider - Frontpage News LastPass password vaults crackable for $100, alleges 1Password https://appleinsider.com/articles/22/12/29/lastpass-password-vaults-crackable-for-100-alleges-1password?utm_medium=rss LastPass password vaults crackable for alleges PasswordLastPass has claimed that it would take millions of years to crack a user s master password but a rival company claims that the process won t take nearly that long and could be done for a mere LastPass a popular password management company recently came under fire when customer data vaults were obtained via an attack in August Now the company s rival Password claims that LastPass isn t protecting customers data enough Read more 2022-12-30 16:10:04
Apple AppleInsider - Frontpage News iPhone 15 may be 35% more power efficient with new TSMC 3nm chip https://appleinsider.com/articles/22/12/29/iphone-15-may-be-35-more-power-efficient-with-new-tsmc-3nm-chip?utm_medium=rss iPhone may be more power efficient with new TSMC nm chipAs it officially launches mass production of nm processors which are expected in the iPhone and new Macs TSMC has boasted of greater power efficiency associated with more speed iPhone Ultra to have a new curved edgeAs expected TSMC held a ceremony on Thursday to mark the official start of production According to Bloomberg executives used the event to make claims about what nm processors will mean for future devices Read more 2022-12-30 16:10:15
Apple AppleInsider - Frontpage News 'Find My' pinpoints location of crash victim stranded overnight https://appleinsider.com/articles/22/12/28/find-my-pinpoints-location-of-crash-victim-stranded-overnight?utm_medium=rss x Find My x pinpoints location of crash victim stranded overnightOn Monday Apple s Find My feature helped rescuers find a woman after she was in a car crash in California and plummeted feet down a hill Find My helped save a woman in CaliforniaThe San Bernardino County Fire Department made a Facebook post on Monday sharing the news of the rescue Read more 2022-12-30 16:10:23
Apple AppleInsider - Frontpage News House of Representatives bans staff use of 'high risk' TikTok https://appleinsider.com/articles/22/12/28/house-of-representatives-bans-staff-use-of-high-risk-tiktok?utm_medium=rss House of Representatives bans staff use of x high risk x TikTokStaff and lawmakers in the House of Representatives have been ordered to uninstall TikTok from their iPhones iPads and Android devices TikTok on a smartphoneThe US government has previously threatened to ban TikTok from the App Store entirely though deadlines for Apple and Google to comply were xjref More recently despite the issue being outside the jurisdiction of the Federal Communications Commission FCC commissioner Brendan Carr has been pressing for a total ban Read more 2022-12-30 16:10:34
Apple AppleInsider - Frontpage News Apple looks to Luxshare for iPhone 15 Pro Max assembly https://appleinsider.com/articles/22/12/28/apple-looks-to-luxshare-for-iphone-15-pro-max-assembly?utm_medium=rss Apple looks to Luxshare for iPhone Pro Max assemblyApple has reportedly chosen Luxshare as an additional manufacturer for the iPhone Pro Max easing its reliance on Foxconn Apple CEO Tim Cook at a Luxshare plantFoxconn has long served as the major manufacturer to assemble iPhone Pro models but recent troubles at its Zhengzhou facility has slowed iPhone Pro production Wednesday s report from Trendforce estimates that iPhone shipments have fallen to million units in due to the impact of COVID at Foxconn s major iPhone factory Read more 2022-12-30 16:11:04
Apple AppleInsider - Frontpage News Foxconn hopes to retain workers by offering cash bonuses https://appleinsider.com/articles/22/12/28/foxconn-hopes-to-retain-workers-by-offering-cash-bonuses?utm_medium=rss Foxconn hopes to retain workers by offering cash bonusesApple supplier Foxconn is offering a subsidy for employees to keep working after struggles with workers over COVID restrictions Foxconn seeks new employeesFoxconn will offer a subsidy for workers who stay in essential roles at the Zhengzhou iPhone factory from January to March By March when Foxconn pays the subsidy workers must be valid employees Read more 2022-12-30 16:12:44
Apple AppleInsider - Frontpage News Former patent attorney sues Apple over harassment & discrimination https://appleinsider.com/articles/22/12/27/former-patent-attorney-sues-apple-over-harassment-discrimination?utm_medium=rss Former patent attorney sues Apple over harassment amp discriminationA former patent attorney for Apple has sued the company over discrimination and harassment after she complained about a male colleague Apple under fire for discriminationJayna Richardson Whitt sued the company in California claiming Apple retaliated against her after it learned of her domestic abuse victim status by turning her down for higher level positions She seeks unspecified compensation for economic losses and emotional distress Read more 2022-12-30 16:21:10
海外科学 NYT > Science The U.S. Will Need Thousands of Wind Farms. Will Small Towns Go Along? https://www.nytimes.com/2022/12/30/climate/wind-farm-renewable-energy-fight.html The U S Will Need Thousands of Wind Farms Will Small Towns Go Along In the fight against climate change national goals are facing local resistance One county scheduled nights of meetings to debate one wind farm 2022-12-30 16:24:51
ニュース BBC News - Home Returns show Trump paid no federal taxes in 2020 https://www.bbc.co.uk/news/world-us-canada-64127825?at_medium=RSS&at_campaign=KARANGA losses 2022-12-30 16:42:52
ニュース BBC News - Home Severe flooding causes road and rail disruption in Scotland https://www.bbc.co.uk/news/uk-scotland-64118732?at_medium=RSS&at_campaign=KARANGA scotland 2022-12-30 16:17:01
ニュース BBC News - Home Cody Fisher stabbing: Birmingham nightclub's licence suspended https://www.bbc.co.uk/news/uk-england-birmingham-64124926?at_medium=RSS&at_campaign=KARANGA fisher 2022-12-30 16:01:09
ニュース BBC News - Home Do restrictions on travel work against Covid? https://www.bbc.co.uk/news/59461861?at_medium=RSS&at_campaign=KARANGA restrictions 2022-12-30 16:33:14
ニュース BBC News - Home Pele: Brazil legend's extraordinary career in pictures https://www.bbc.co.uk/sport/football/64125974?at_medium=RSS&at_campaign=KARANGA incredible 2022-12-30 16:45:15

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)