← QCE Digital Solutions Unit 4

Streaming data packets

Sending packets continuously from a server to one viewer, who plays them as they arrive instead of waiting for the whole file to download.

Understanding Streaming data packets in QCE Digital Solutions Unit 4

What it does: UDP does not resend lost packets, so a live stream keeps playing instead of waiting, which suits timely delivery. On-demand video is stored on the server and sent as packets to one viewer, who plays it as it arrives. Live streaming sends packets as the event happens. Streaming lets playback begin while later packets are still on their way. Downloading the whole file first is the opposite approach. A stream goes from the server to a single viewer. Sending to every device on a network is broadcasting. Adaptive streaming lowers the bitrate (lower quality) when bandwidth drops. This reduces buffering.

Common mistakes: Streamed packets are added to the buffer as they arrive so they can be played shortly after. It should be buffer.append(packet), not pop(packet). When the connection is slower than the bitrate, the stream should drop to a lower bitrate to avoid buffering. Raising it to 8000 makes the problem worse. It should be a lower value such as 1000.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 89–125) and word search (Modules 17–125).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which describes streaming data packets?
The server sends packets continuously and the viewer plays them as they arriveThe viewer must download the whole file before playback can start
Matches
Streaming: download the entire file first, then press play
↓
This describes downloading, not streaming. Streaming plays packets as they arrive, without waiting for the whole file.
Applying
Meanings
Term
streaming
Meaning
Sending packets continuously from a server to one viewer, who plays them as they arrive instead of waiting for the whole file to download.
Practice
packets = ["P1", "P2", "P3", "P4"]
Testing
Gaps
stream = openStream(url, protocol="")
Check Answer
Spots
2for packet in stream:
3 buffer.pop(packet)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Squirrel' badge — Module Hoarder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which describes streaming data packets?
A. The server sends packets continuously and the viewer plays them as they arrive ✓
B. The viewer must download the whole file before playback can start
Streaming lets playback begin while later packets are still on their way. Downloading the whole file first is the opposite approach.
2. Streaming sends data from a server to how many viewers per stream?
A. Every device on the network at once
B. One viewer (one-to-one) ✓
A stream goes from the server to a single viewer. Sending to every device on a network is broadcasting.
3. A video player pauses to load more packets before it carries on playing. What is this called?
A. Buffering ✓
B. Hashing
Buffering happens when packets arrive too slowly, so the player runs out of stored data and has to wait for more.
4. Which is an example of on-demand streaming?
A. Watching a sports match as it happens, with the stream sent out in real time
B. Choosing a recorded show on a streaming service and pressing play ✓
On-demand content is already recorded and stored on the server. The live match is live streaming.
5. Which transport protocol is often used for streaming because it favours speed over guaranteed delivery?
A. UDP ✓
B. TCP
UDP does not wait to resend lost packets, so the stream keeps flowing. A missing packet only causes a small glitch. TCP's retransmissions can add delay.

Match the Pairs

buffering → The player pauses and stores incoming packets ahead of playback, so a slow or late packet does not stop the video
adjust bitrate → The server lowers or raises the amount of data sent each second to match the viewer's current connection speed
Streaming is often sent with UDP because dropping a late packet is better than pausing to resend it → protocol = UDP
On-demand streaming sends a stored file to one viewer, who can start playing it before the whole file has arrived → stream_type = on-demand
Streaming: download the entire file first, then press play → This describes downloading, not streaming. Streaming plays packets as they arrive, without waiting for the whole file.
Streaming sends the same packets to every device on the network at once → This describes broadcasting. Streaming sends packets from a server to one viewer, not to every device.

Key Term

streaming
Sending packets continuously from a server to one viewer, who plays them as they arrive instead of waiting for the whole file to download.

Fill in the Blanks

1. stream = openStream(url, protocol="UDP")
Hint: Type the protocol, often chosen for live streaming, that does not stop to resend lost packets.
2. buffer = 1.5 if buffer < 2: pause()
Hint: Type the variable that was just set to the seconds of video stored ahead of the playing point.
3. packet = latest if isLive else nextOne
Hint: Type the keyword that picks the other option when the stream is on-demand instead of live.
4. if bandwidth < bitrate: bitrate = bitrate / 2
Hint: Type the comparison operator that checks whether the connection is slower than the video's data rate.
5. while stream.isOpen: packet = stream.receive() play(packet)
Hint: Type the function name that shows each packet straight away instead of waiting for the whole file.

Spot the Error

Question 1
A buffer = []
B for packet in stream:
C buffer.pop(packet)
D if len(buffer) >= 3:
E play(buffer.pop(0))
Line C — Streamed packets are added to the buffer as they arrive so they can be played shortly after. It should be buffer.append(packet), not pop(packet).
Question 2
A speed = measure_speed()
B bitrate = 4000
C if speed < bitrate:
D bitrate = 8000
Line D — When the connection is slower than the bitrate, the stream should drop to a lower bitrate to avoid buffering. Raising it to 8000 makes the problem worse. It should be a lower value such as 1000.
Question 3
A buffering = False
B while buffering:
C wait_for_packets()
D buffering = len(buf) < 3
Line A — The player starts out buffering, so the flag must start as True. If it starts as False, the while loop never runs and no packets are collected before playback.
Question 4
A def play_stream(server)
B packet = server.next()
C show(packet)
D return packet
Line A — A function definition must end with a colon. It should be def play_stream(server):
Question 5
A mode = 'live'
B start = 0
C stream_from(start)
Line B — A live stream is happening right now, so a viewer joins at the current moment with now(). Starting at 0 is how an on-demand video behaves, not a live one.

Student with a class code? Join your class →