Reply
New Member
cmset
Posts: 2
Registered: ‎11-22-2011
0 Kudos
Accepted Solution

Player in iOS UIWebView

Hello,

 

In our exploitation of Brightcove solution, we use IOS UIWebView to visualize HTML content that contain videos declared by JavaScript. The player work in safari mobile.

 

Any ideas ?

 

Thanks you.

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: Player in iOS UIWebView

 

 Yes, if your player is set for HTML5 delivery you can embed it in the UIWebView.  I have seen this combo working. 

New Member
cmset
Posts: 2
Registered: ‎11-22-2011
0 Kudos

Re: Player in iOS UIWebView

Thanks your help. I'think the problem is in the json stream that feed the UIWebview.

Visitor
tmarks
Posts: 4
Registered: ‎12-13-2011
0 Kudos

Re: Player in iOS UIWebView

I've embedded the player in a UIWebView, but can't get the video to play.  The play icon overlays the video image, but no playback.  How do I enable the playback?

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: Player in iOS UIWebView

 

 A couple of questions:

 

- Does the player work fine outside the UIWebView? Like does it play in the browser? If the content doesn't play there either it might be that you don't have the correct rendition for iOS which are h264 encoded files or HTTP Live Streaming from Apple

 

- What technique are you using the embed the player in the UIWebView?

 

 

Visitor
tmarks
Posts: 4
Registered: ‎12-13-2011
0 Kudos

Re: Player in iOS UIWebView

Thanks for the quick response.

 

The player works fine outside of the app, but can't get it to play inside the app.  In the UIWebView, I'm making a call to a web page that has the player code.

Visitor
tmarks
Posts: 4
Registered: ‎12-13-2011
0 Kudos

Re: Player in iOS UIWebView

Sorry, forgot the code:

 

<div class='header'>%header%</div>

<br/>

        <div class='mainContent'>

        <!--

         By use of this code snippet, I agree to the Brightcove Publisher T and C

         found at https://accounts.brightcove.com/en/terms-and-conditions/.

         -->

        

        <script language="JavaScript"type="text/javascript"src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>

        

        <object id="myExperienceSOMESTRING"class="BrightcoveExperience">

            <param name="bgcolor"value="#FFFFFF" />

            <param name="width" value="480" />

            <param name="height"value="270" />

            <param name="playerID"value="SOMESTRING" />

            <param name="playerKey"value="SOMESTRING" />

            <param name="isVid"value="true" />

            <param name="isUI" value="true" />

            <param name="dynamicStreaming"value="true" />

            

            <param name="@videoPlayer"value="%videoid%" />        

        </object>

 

 

        <!--

         This script tag will cause the Brightcove Players defined above it to be created as soon

         as the line is read by the browser. If you wish to have the player instantiated only after

         the rest of the HTML is processed and the page load is complete, remove the line.

         -->

        <script type="text/javascript">brightcove.createExperiences();</script>

     

            

        <!-- End of Brightcove Player -->        </div>

 

 

THE CALL:

 

NSString *localPath;

NSString *html;

 

if( [[rssArrayobjectAtIndex:0] valueForKey:@"title" ] == nil ||

[[rssArrayobjectAtIndex:0] valueForKey:@"body"  ] == nil  

        || [[rssArray objectAtIndex:0] valueForKey:@"videoid"  ] == nil ){

 

localPath = [NSStringstringWithFormat:@"%@/carStoryError.html",[[NSBundlemainBundle] resourcePath]];

html = [NSStringstringWithContentsOfFile:localPath encoding:NSUTF8StringEncodingerror:nil ];

 

}

    

    else

    {

 

localPath = [NSStringstringWithFormat:@"%@/carStory.html",[[NSBundlemainBundle] resourcePath]];

html = [NSStringstringWithContentsOfFile:localPath encoding:NSUTF8StringEncodingerror:nil ];

 

html = [ html stringByReplacingOccurrencesOfString:@"%header%"withString:[[rssArrayobjectAtIndex:0] valueForKey:@"title" ]];

html = [ html stringByReplacingOccurrencesOfString:@"%body%"withString:[[rssArrayobjectAtIndex:0] valueForKey:@"body" ]];

        html = [ html stringByReplacingOccurrencesOfString:@"%videoid%"withString:[[rssArrayobjectAtIndex:0] valueForKey:@"videoid" ]];

 

}

 


Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: Player in iOS UIWebView

This code worked for me:


NSString *path = [[NSBundle mainBundle] pathForResource:@"webViewContent" ofType:@"html"];
   NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];
           
   NSString *htmlString = [[NSString alloc] initWithData:
                             [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];
   
       [self.webView loadHTMLString:htmlString baseURL:nil];
   [htmlString release];

New Member
ranadeep_bhuyan
Posts: 1
Registered: ‎01-25-2012
0 Kudos

Re: Player in iOS UIWebView

it is not owrking for me too.

 

i am using phonegap 1.3.0 to view an HTML page in my UIview,

The player javascript code works fine if I run the html page outside my app (i.e. in mobile Safari). But when i build the html with native UIview then it shows only a white background in place of the player.

 

please see the attahced screen shot.

 

any idea, wht could be my possible mistake?

 

-Rana

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: Player in iOS UIWebView

 

 Any chance that you can post a simplified project to try out?