xamxier
xamxier

Reputation: 1

How to record screen and broadcast to smart TV in the same wifi network on ios app?

I used Broadcast Extension for screen recording on ios device. But I don't know how to stream ios device screen to smart TV on same wifi network?

Upvotes: 0

Views: 1125

Answers (3)

Copper
Copper

Reputation: 11

I have written content to HTTPStream (CMSampleBuffer), I use this URL and cast to TV, it doesn't work.

let url = URL.init(string: "abc.m38u")!
let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentURL: url)
mediaInfoBuilder.streamType = GCKMediaStreamType.buffered
mediaInfoBuilder.contentID = mediaURL.absoluteString
mediaInfoBuilder.contentType = mediaURL.mimeType()
mediaInfoBuilder.hlsSegmentFormat =.TS
mediaInfoBuilder.hlsVideoSegmentFormat=.MPEG2_TS
//mediaInfoBuilder.streamDuration = .infinity

The errors is : -Error Domain=com.google.cast.GCKError Code=30 "Media failed to load" UserInfo={NSLocalizedDescription=Media failed to load, gck_detailed_error_code=301} -[GCKMediaControlChannel didReceiveTextMessage:] - Received unexpected error: INVALID_REQUEST -[GCKMediaQueue request:didFailWithError:] - error fetching queue item IDs: Error Domain=com.google.cast.GCKError Code=4 "Invalid request" UserInfo={gck_error_reason=INVALID_MEDIA_SESSION_ID, NSLocalizedDescription=Invalid request, gck_custom_data=INVALID_MEDIA_SESSION_ID}

How can I fix that.

In addition, using "HLS" content will be delayed 5 to 10 seconds compared to iPhone. Besides using "HLS", is there any other way?

Thanks.

Upvotes: 0

Quang Hà
Quang Hà

Reputation: 4746

Technique:

  • write your screen record as video format to device's storage.
  • start a hls server on your app and enable streaming url to video's data.
  • beam the hls url to your TV media player.

Your TV media player will play the screen record. You can do a research with HaishinKit for detail.

Upvotes: 0

mobin ghaffari
mobin ghaffari

Reputation: 11

Connect your device to the same Wi-Fi network as your Apple TV or AirPlay 2-compatible smart TV. Find the video that you want to stream. Tap AirPlay . In some apps, you might need to tap a different icon first.* In the Photos app, tap Share , then tap AirPlay . Choose your Apple TV or AirPlay 2-compatible smart TV. To stop streaming, tap AirPlay in the app that you're streaming from, then tap your iPhone, iPad, or iPod touch from the list.

Upvotes: 1

Related Questions